From b2b977ddd9dfba8547f6f107284a6656d5ff17e4 Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 Date: Thu, 26 Mar 2026 11:35:04 +0800 Subject: [PATCH 1/3] generated from swagger:5ce63776b93010e2ef6ba8d14b79b3b95bdc47d6 --- .../CHANGELOG.md | 4 + .../MANIFEST.in | 8 +- .../_metadata.json | 6 +- .../apiview-properties.json | 30 + .../azure/__init__.py | 2 +- .../azure/mgmt/__init__.py | 2 +- .../mgmt/applicationinsights/__init__.py | 30 - .../azure/mgmt/applicationinsights/_patch.py | 21 +- .../mgmt/applicationinsights/_version.py | 9 +- .../v2015_05_01/__init__.py | 32 + ..._application_insights_management_client.py | 98 +- .../{ => v2015_05_01}/_configuration.py | 21 +- .../{aio => v2015_05_01}/_patch.py | 4 +- .../{ => v2015_05_01}/_utils/__init__.py | 0 .../{ => v2015_05_01}/_utils/serialization.py | 43 +- .../v2015_05_01/_version.py | 9 + .../{ => v2015_05_01}/aio/__init__.py | 0 ..._application_insights_management_client.py | 101 +- .../{ => v2015_05_01}/aio/_configuration.py | 21 +- .../operations => v2015_05_01/aio}/_patch.py | 4 +- .../aio/operations/__init__.py | 18 +- .../operations/_analytics_items_operations.py | 51 +- .../aio/operations/_annotations_operations.py | 59 +- .../aio/operations/_api_keys_operations.py | 46 +- ...component_available_features_operations.py | 12 +- ...ent_current_billing_features_operations.py | 28 +- ...mponent_feature_capabilities_operations.py | 12 +- .../_component_quota_status_operations.py | 12 +- .../aio/operations/_components_operations.py | 129 +- .../_export_configurations_operations.py | 50 +- .../aio/operations/_favorites_operations.py | 48 +- .../operations/_my_workbooks_operations.py | 653 + .../aio/operations/_operations.py | 30 +- .../aio/operations}/_patch.py | 4 +- ...ive_detection_configurations_operations.py | 28 +- .../_web_test_locations_operations.py | 25 +- .../aio/operations/_web_tests_operations.py | 676 + .../_work_item_configurations_operations.py | 65 +- .../aio/operations/_workbooks_operations.py | 555 + .../{ => v2015_05_01}/models/__init__.py | 106 +- ...cation_insights_management_client_enums.py | 53 +- .../{ => v2015_05_01}/models/_models_py3.py | 2742 +- .../models}/_patch.py | 4 +- .../{ => v2015_05_01}/operations/__init__.py | 18 +- .../operations/_analytics_items_operations.py | 51 +- .../operations/_annotations_operations.py | 60 +- .../operations/_api_keys_operations.py | 46 +- ...component_available_features_operations.py | 12 +- ...ent_current_billing_features_operations.py | 28 +- ...mponent_feature_capabilities_operations.py | 12 +- .../_component_quota_status_operations.py | 12 +- .../operations/_components_operations.py | 1061 + .../_export_configurations_operations.py | 50 +- .../operations/_favorites_operations.py | 48 +- .../operations/_my_workbooks_operations.py | 865 + .../operations/_operations.py | 33 +- .../v2015_05_01/operations/_patch.py | 21 + ...ive_detection_configurations_operations.py | 27 +- .../_web_test_locations_operations.py | 25 +- .../operations/_web_tests_operations.py | 889 + .../_work_item_configurations_operations.py | 64 +- .../operations/_workbooks_operations.py | 732 + .../{ => v2015_05_01}/py.typed | 0 .../v2017_10_01/__init__.py | 32 + ..._application_insights_management_client.py | 155 + .../v2017_10_01/_configuration.py | 75 + .../applicationinsights/v2017_10_01/_patch.py | 21 + .../v2017_10_01/_utils/__init__.py | 6 + .../v2017_10_01/_utils/serialization.py | 2041 + .../v2017_10_01/_version.py | 9 + .../v2017_10_01/aio/__init__.py | 29 + ..._application_insights_management_client.py | 159 + .../v2017_10_01/aio/_configuration.py | 75 + .../v2017_10_01/aio/_patch.py | 21 + .../v2017_10_01/aio/operations/__init__.py | 32 + ...mponent_current_pricing_plan_operations.py | 395 + ...cription_list_migration_date_operations.py | 102 + ...migrate_to_new_pricing_model_operations.py | 98 + ...back_to_legacy_pricing_model_operations.py | 98 + .../v2017_10_01/aio/operations/_patch.py | 21 + .../v2017_10_01/models/__init__.py | 33 + .../v2017_10_01/models/_models_py3.py | 219 + .../v2017_10_01/models/_patch.py | 21 + .../v2017_10_01/operations/__init__.py | 32 + ...mponent_current_pricing_plan_operations.py | 497 + ...cription_list_migration_date_operations.py | 128 + ...migrate_to_new_pricing_model_operations.py | 126 + ...back_to_legacy_pricing_model_operations.py | 126 + .../v2017_10_01/operations/_patch.py | 21 + .../applicationinsights/v2017_10_01/py.typed | 1 + .../v2018_05_01_preview/__init__.py | 32 + ..._application_insights_management_client.py | 141 + .../v2018_05_01_preview/_configuration.py | 75 + .../v2018_05_01_preview/_patch.py | 21 + .../v2018_05_01_preview/_utils/__init__.py | 6 + .../_utils/serialization.py | 2041 + .../v2018_05_01_preview/_version.py | 9 + .../v2018_05_01_preview/aio/__init__.py | 29 + ..._application_insights_management_client.py | 146 + .../v2018_05_01_preview/aio/_configuration.py | 75 + .../v2018_05_01_preview/aio/_patch.py | 21 + .../aio/operations/__init__.py | 31 + .../aio/operations/_components_operations.py | 817 + .../aio/operations/_operations.py | 133 + .../aio/operations/_patch.py | 21 + ...ive_detection_configurations_operations.py | 350 + .../aio/operations/_web_tests_operations.py | 676 + .../v2018_05_01_preview/models/__init__.py | 90 + ...cation_insights_management_client_enums.py | 76 + .../v2018_05_01_preview/models/_models_py3.py | 1302 + .../v2018_05_01_preview/models/_patch.py | 21 + .../operations/__init__.py | 31 + .../operations/_components_operations.py | 1063 + .../operations/_operations.py | 154 + .../v2018_05_01_preview/operations/_patch.py | 21 + ...ive_detection_configurations_operations.py | 452 + .../operations/_web_tests_operations.py | 889 + .../v2018_05_01_preview/py.typed | 1 + .../v2018_06_17_preview/__init__.py | 32 + ..._application_insights_management_client.py | 131 + .../v2018_06_17_preview/_configuration.py | 75 + .../v2018_06_17_preview/_patch.py | 21 + .../v2018_06_17_preview/_utils/__init__.py | 6 + .../_utils/serialization.py | 2041 + .../v2018_06_17_preview/_version.py | 9 + .../v2018_06_17_preview/aio/__init__.py | 29 + ..._application_insights_management_client.py | 136 + .../v2018_06_17_preview/aio/_configuration.py | 75 + .../v2018_06_17_preview/aio/_patch.py | 21 + .../aio/operations/__init__.py | 27 + .../aio/operations/_operations.py} | 63 +- .../aio/operations/_patch.py | 21 + .../aio/operations/_workbooks_operations.py | 585 + .../v2018_06_17_preview/models/__init__.py | 52 + ...cation_insights_management_client_enums.py | 26 + .../v2018_06_17_preview/models/_models_py3.py | 484 + .../v2018_06_17_preview/models/_patch.py | 21 + .../operations/__init__.py | 27 + .../operations/_operations.py} | 83 +- .../v2018_06_17_preview/operations/_patch.py | 21 + .../operations/_workbooks_operations.py | 766 + .../v2018_06_17_preview/py.typed | 1 + .../v2019_10_17_preview/__init__.py | 32 + ..._application_insights_management_client.py | 130 + .../v2019_10_17_preview/_configuration.py | 75 + .../v2019_10_17_preview/_patch.py | 21 + .../v2019_10_17_preview/_utils/__init__.py | 6 + .../_utils/serialization.py | 2041 + .../v2019_10_17_preview/_version.py | 9 + .../v2019_10_17_preview/aio/__init__.py | 29 + ..._application_insights_management_client.py | 134 + .../v2019_10_17_preview/aio/_configuration.py | 75 + .../v2019_10_17_preview/aio/_patch.py | 21 + .../aio/operations/__init__.py | 25 + .../aio/operations/_patch.py | 21 + .../_workbook_templates_operations.py | 548 + .../v2019_10_17_preview/models/__init__.py | 41 + .../v2019_10_17_preview/models/_models_py3.py | 412 + .../v2019_10_17_preview/models/_patch.py | 21 + .../operations/__init__.py | 25 + .../v2019_10_17_preview/operations/_patch.py | 21 + .../_workbook_templates_operations.py | 709 + .../v2019_10_17_preview/py.typed | 1 + .../v2020_02_02/__init__.py | 32 + ..._application_insights_management_client.py | 127 + .../v2020_02_02/_configuration.py | 75 + .../applicationinsights/v2020_02_02/_patch.py | 21 + .../v2020_02_02/_utils/__init__.py | 6 + .../v2020_02_02/_utils/serialization.py | 2041 + .../v2020_02_02/_version.py | 9 + .../v2020_02_02/aio/__init__.py | 29 + ..._application_insights_management_client.py | 132 + .../v2020_02_02/aio/_configuration.py | 75 + .../v2020_02_02/aio/_patch.py | 21 + .../v2020_02_02/aio/operations/__init__.py | 25 + .../aio/operations/_components_operations.py | 859 + .../v2020_02_02/aio/operations/_patch.py | 21 + .../v2020_02_02/models/__init__.py | 62 + ...cation_insights_management_client_enums.py | 60 + .../v2020_02_02/models/_models_py3.py | 615 + .../v2020_02_02/models/_patch.py | 21 + .../v2020_02_02/operations/__init__.py | 25 + .../operations/_components_operations.py | 132 +- .../v2020_02_02/operations/_patch.py | 21 + .../applicationinsights/v2020_02_02/py.typed | 1 + .../v2020_02_02_preview/__init__.py | 32 + ..._application_insights_management_client.py | 128 + .../v2020_02_02_preview/_configuration.py | 75 + .../v2020_02_02_preview/_patch.py | 21 + .../v2020_02_02_preview/_utils/__init__.py | 6 + .../_utils/serialization.py | 2041 + .../v2020_02_02_preview/_version.py | 9 + .../v2020_02_02_preview/aio/__init__.py | 29 + ..._application_insights_management_client.py | 132 + .../v2020_02_02_preview/aio/_configuration.py | 75 + .../v2020_02_02_preview/aio/_patch.py | 21 + .../aio/operations/__init__.py | 25 + .../aio/operations/_components_operations.py | 849 + .../aio/operations/_patch.py | 21 + .../v2020_02_02_preview/models/__init__.py | 64 + ...cation_insights_management_client_enums.py | 60 + .../v2020_02_02_preview/models/_models_py3.py | 657 + .../v2020_02_02_preview/models/_patch.py | 21 + .../operations/__init__.py | 25 + .../operations/_components_operations.py | 1101 + .../v2020_02_02_preview/operations/_patch.py | 21 + .../v2020_02_02_preview/py.typed | 1 + .../v2020_03_01_preview/__init__.py | 32 + ..._application_insights_management_client.py | 130 + .../v2020_03_01_preview/_configuration.py | 75 + .../v2020_03_01_preview/_patch.py | 21 + .../v2020_03_01_preview/_utils/__init__.py | 6 + .../_utils/serialization.py | 2041 + .../v2020_03_01_preview/_version.py | 9 + .../v2020_03_01_preview/aio/__init__.py | 29 + ..._application_insights_management_client.py | 134 + .../v2020_03_01_preview/aio/_configuration.py | 75 + .../v2020_03_01_preview/aio/_patch.py | 21 + .../aio/operations/__init__.py | 25 + ...nent_linked_storage_accounts_operations.py | 89 +- .../aio/operations/_patch.py | 21 + .../v2020_03_01_preview/models/__init__.py | 42 + ...cation_insights_management_client_enums.py | 16 + .../v2020_03_01_preview/models/_models_py3.py | 179 + .../v2020_03_01_preview/models/_patch.py | 21 + .../operations/__init__.py | 25 + ...nent_linked_storage_accounts_operations.py | 89 +- .../v2020_03_01_preview/operations/_patch.py | 21 + .../v2020_03_01_preview/py.typed | 1 + .../v2020_06_02_preview/__init__.py | 32 + ..._application_insights_management_client.py | 124 + .../v2020_06_02_preview/_configuration.py | 66 + .../v2020_06_02_preview/_patch.py | 21 + .../v2020_06_02_preview/_utils/__init__.py | 6 + .../_utils/serialization.py | 2041 + .../v2020_06_02_preview/_version.py | 9 + .../v2020_06_02_preview/aio/__init__.py | 29 + ..._application_insights_management_client.py | 129 + .../v2020_06_02_preview/aio/_configuration.py | 66 + .../v2020_06_02_preview/aio/_patch.py | 21 + .../aio/operations/__init__.py | 27 + .../aio/operations/_live_token_operations.py | 109 + .../aio/operations/_operations.py | 134 + .../aio/operations/_patch.py | 21 + .../v2020_06_02_preview/models/__init__.py | 37 + .../v2020_06_02_preview/models/_models_py3.py | 213 + .../v2020_06_02_preview/models/_patch.py | 21 + .../operations/__init__.py | 27 + .../operations/_live_token_operations.py | 135 + .../operations/_operations.py | 154 + .../v2020_06_02_preview/operations/_patch.py | 21 + .../v2020_06_02_preview/py.typed | 1 + .../v2020_11_20/__init__.py | 32 + ..._application_insights_management_client.py | 130 + .../v2020_11_20/_configuration.py | 75 + .../applicationinsights/v2020_11_20/_patch.py | 21 + .../v2020_11_20/_utils/__init__.py | 6 + .../v2020_11_20/_utils/serialization.py | 2041 + .../v2020_11_20/_version.py | 9 + .../v2020_11_20/aio/__init__.py | 29 + ..._application_insights_management_client.py | 134 + .../v2020_11_20/aio/_configuration.py | 75 + .../v2020_11_20/aio/_patch.py | 21 + .../v2020_11_20/aio/operations/__init__.py | 25 + .../v2020_11_20/aio/operations/_patch.py | 21 + .../_workbook_templates_operations.py | 86 +- .../v2020_11_20/models/__init__.py | 43 + .../v2020_11_20/models/_models_py3.py | 430 + .../v2020_11_20/models/_patch.py | 21 + .../v2020_11_20/operations/__init__.py | 25 + .../v2020_11_20/operations/_patch.py | 21 + .../_workbook_templates_operations.py | 87 +- .../applicationinsights/v2020_11_20/py.typed | 1 + .../v2021_03_08/__init__.py | 32 + ..._application_insights_management_client.py | 128 + .../v2021_03_08/_configuration.py | 75 + .../applicationinsights/v2021_03_08/_patch.py | 21 + .../v2021_03_08/_utils/__init__.py | 6 + .../v2021_03_08/_utils/serialization.py | 2041 + .../v2021_03_08/_version.py | 9 + .../v2021_03_08/aio/__init__.py | 29 + ..._application_insights_management_client.py | 132 + .../v2021_03_08/aio/_configuration.py | 75 + .../v2021_03_08/aio/_patch.py | 21 + .../v2021_03_08/aio/operations/__init__.py | 25 + .../operations/_my_workbooks_operations.py | 683 + .../v2021_03_08/aio/operations/_patch.py | 21 + .../v2021_03_08/models/__init__.py | 54 + ...cation_insights_management_client_enums.py | 42 + .../v2021_03_08/models/_models_py3.py | 469 + .../v2021_03_08/models/_patch.py | 21 + .../v2021_03_08/operations/__init__.py | 25 + .../operations/_my_workbooks_operations.py | 912 + .../v2021_03_08/operations/_patch.py | 21 + .../applicationinsights/v2021_03_08/py.typed | 1 + .../v2021_08_01/__init__.py | 32 + ..._application_insights_management_client.py | 127 + .../v2021_08_01/_configuration.py | 75 + .../applicationinsights/v2021_08_01/_patch.py | 21 + .../v2021_08_01/_utils/__init__.py | 6 + .../v2021_08_01/_utils/serialization.py | 2041 + .../v2021_08_01/_version.py | 9 + .../v2021_08_01/aio/__init__.py | 29 + ..._application_insights_management_client.py | 132 + .../v2021_08_01/aio/_configuration.py | 75 + .../v2021_08_01/aio/_patch.py | 21 + .../v2021_08_01/aio/operations/__init__.py | 25 + .../v2021_08_01/aio/operations/_patch.py | 21 + .../aio/operations/_workbooks_operations.py | 849 + .../v2021_08_01/models/__init__.py | 64 + ...cation_insights_management_client_enums.py | 53 + .../v2021_08_01/models/_models_py3.py | 706 + .../v2021_08_01/models/_patch.py | 21 + .../v2021_08_01/operations/__init__.py | 25 + .../v2021_08_01/operations/_patch.py | 21 + .../operations/_workbooks_operations.py | 1152 + .../applicationinsights/v2021_08_01/py.typed | 1 + .../applicationinsights/v2021_10/__init__.py | 32 + ..._application_insights_management_client.py | 120 + .../v2021_10/_configuration.py | 66 + .../applicationinsights/v2021_10/_patch.py | 21 + .../v2021_10/_utils/__init__.py | 6 + .../v2021_10/_utils/serialization.py | 2041 + .../applicationinsights/v2021_10/_version.py | 9 + .../v2021_10/aio/__init__.py | 29 + ..._application_insights_management_client.py | 124 + .../v2021_10/aio/_configuration.py | 66 + .../v2021_10/aio/_patch.py | 21 + .../v2021_10/aio/operations/__init__.py | 25 + .../aio/operations/_live_token_operations.py | 15 +- .../v2021_10/aio/operations/_patch.py | 21 + .../v2021_10/models/__init__.py | 37 + .../v2021_10/models/_models_py3.py | 218 + .../v2021_10/models/_patch.py | 21 + .../v2021_10/operations/__init__.py | 25 + .../operations/_live_token_operations.py | 15 +- .../v2021_10/operations/_patch.py | 21 + .../applicationinsights/v2021_10/py.typed | 1 + .../v2022_04_01/__init__.py | 32 + ..._application_insights_management_client.py | 127 + .../v2022_04_01/_configuration.py | 75 + .../applicationinsights/v2022_04_01/_patch.py | 21 + .../v2022_04_01/_utils/__init__.py | 6 + .../v2022_04_01/_utils/serialization.py | 2041 + .../v2022_04_01/_version.py | 9 + .../v2022_04_01/aio/__init__.py | 29 + ..._application_insights_management_client.py | 132 + .../v2022_04_01/aio/_configuration.py | 75 + .../v2022_04_01/aio/_patch.py | 21 + .../v2022_04_01/aio/operations/__init__.py | 25 + .../v2022_04_01/aio/operations/_patch.py | 21 + .../aio/operations/_workbooks_operations.py | 164 +- .../v2022_04_01/models/__init__.py | 64 + ...cation_insights_management_client_enums.py | 51 + .../v2022_04_01/models/_models_py3.py | 704 + .../v2022_04_01/models/_patch.py | 21 + .../v2022_04_01/operations/__init__.py | 25 + .../v2022_04_01/operations/_patch.py | 21 + .../operations/_workbooks_operations.py | 187 +- .../applicationinsights/v2022_04_01/py.typed | 1 + .../v2022_06_15/__init__.py | 32 + ..._application_insights_management_client.py | 127 + .../v2022_06_15/_configuration.py | 75 + .../applicationinsights/v2022_06_15/_patch.py | 21 + .../v2022_06_15/_utils/__init__.py | 6 + .../v2022_06_15/_utils/serialization.py | 2041 + .../v2022_06_15/_version.py | 9 + .../v2022_06_15/aio/__init__.py | 29 + ..._application_insights_management_client.py | 132 + .../v2022_06_15/aio/_configuration.py | 75 + .../v2022_06_15/aio/_patch.py | 21 + .../v2022_06_15/aio/operations/__init__.py | 25 + .../v2022_06_15/aio/operations/_patch.py | 21 + .../aio/operations/_web_tests_operations.py | 94 +- .../v2022_06_15/models/__init__.py | 50 + ...cation_insights_management_client_enums.py | 18 + .../v2022_06_15/models/_models_py3.py | 511 + .../v2022_06_15/models/_patch.py | 21 + .../v2022_06_15/operations/__init__.py | 25 + .../v2022_06_15/operations/_patch.py | 21 + .../operations/_web_tests_operations.py | 94 +- .../applicationinsights/v2022_06_15/py.typed | 1 + .../code_report_swagger.json | 46938 ++++++++++++++++ .../analytics_item_delete.py | 2 +- .../{ => v2015_05_01}/analytics_item_get.py | 2 +- .../{ => v2015_05_01}/analytics_item_list.py | 2 +- .../{ => v2015_05_01}/analytics_item_put.py | 2 +- .../v2015_05_01/annotations_create.py | 51 + .../{ => v2015_05_01}/annotations_delete.py | 2 +- .../{ => v2015_05_01}/annotations_get.py | 2 +- .../{ => v2015_05_01}/annotations_list.py | 2 +- .../{ => v2015_05_01}/api_keys_create.py | 2 +- .../{ => v2015_05_01}/api_keys_delete.py | 2 +- .../{ => v2015_05_01}/api_keys_get.py | 2 +- .../{ => v2015_05_01}/api_keys_list.py | 2 +- .../available_billing_features_get.py | 2 +- .../v2015_05_01/components_create.py | 69 + .../v2015_05_01/components_delete.py | 42 + .../v2015_05_01/components_get.py | 43 + .../v2015_05_01/components_list.py | 41 + .../components_list_by_resource_group.py | 43 + .../v2015_05_01/components_purge.py | 47 + .../v2015_05_01/components_purge_status.py | 44 + .../v2015_05_01/components_update.py | 69 + .../components_update_tags_only.py | 44 + .../current_billing_features_get.py | 2 +- .../current_billing_features_update.py | 54 + .../export_configuration_delete.py | 2 +- .../export_configuration_get.py | 2 +- .../export_configuration_update.py | 55 + .../export_configurations_list.py | 2 +- .../v2015_05_01/export_configurations_post.py | 54 + .../{ => v2015_05_01}/favorite_add.py | 2 +- .../{ => v2015_05_01}/favorite_delete.py | 2 +- .../{ => v2015_05_01}/favorite_get.py | 2 +- .../{ => v2015_05_01}/favorite_update.py | 2 +- .../{ => v2015_05_01}/favorites_list.py | 2 +- .../feature_capabilities_get.py | 2 +- .../v2015_05_01/my_workbook_add.py | 56 + .../v2015_05_01/my_workbook_delete.py | 42 + .../v2015_05_01/my_workbook_get.py | 43 + .../v2015_05_01/my_workbook_update.py | 56 + .../v2015_05_01/my_workbooks_list.py | 44 + .../proactive_detection_configuration_get.py | 2 +- ...roactive_detection_configuration_update.py | 61 + ...proactive_detection_configurations_list.py | 2 +- .../{ => v2015_05_01}/quota_status_get.py | 2 +- .../v2015_05_01/web_test_create.py | 62 + .../v2015_05_01/web_test_delete.py | 42 + .../v2015_05_01/web_test_get.py | 43 + .../v2015_05_01/web_test_list.py | 41 + .../v2015_05_01/web_test_list_by_component.py | 44 + .../web_test_list_by_resource_group.py | 43 + .../web_test_locations_list.py | 2 +- .../v2015_05_01/web_test_update.py | 62 + .../v2015_05_01/web_test_update_tags_only.py | 44 + .../v2015_05_01/work_item_config_create.py | 49 + .../work_item_config_default_get.py | 2 +- .../work_item_config_delete.py | 2 +- .../{ => v2015_05_01}/work_item_config_get.py | 2 +- .../v2015_05_01/work_item_config_update.py | 50 + .../work_item_configs_get.py | 2 +- .../v2015_05_01/workbook_add.py | 59 + .../v2015_05_01/workbook_delete.py | 42 + .../{ => v2015_05_01}/workbook_get.py | 4 +- .../v2015_05_01/workbook_update.py | 58 + .../{ => v2015_05_01}/workbooks_list.py | 4 +- .../current_pricing_plan_create_and_update.py | 55 + .../v2017_10_01/current_pricing_plan_get.py | 43 + .../current_pricing_plan_update.py | 55 + .../ea_subscription_list_migration_date.py | 40 + ...ption_migrate_to_new_pricing_model_post.py | 39 + ...n_rollback_to_legacy_pricing_model_post.py | 39 + .../v2018_05_01_preview/components_create.py | 71 + .../v2018_05_01_preview/components_delete.py | 42 + .../v2018_05_01_preview/components_get.py | 43 + .../v2018_05_01_preview/components_list.py | 41 + .../components_list_by_resource_group.py | 43 + .../v2018_05_01_preview/components_purge.py | 47 + .../components_purge_status.py | 44 + .../v2018_05_01_preview/components_update.py | 71 + .../components_update_tags_only.py | 44 + .../operations_list.py} | 10 +- .../proactive_detection_configuration_get.py | 44 + ...roactive_detection_configuration_update.py | 65 + ...proactive_detection_configurations_list.py | 43 + .../v2018_05_01_preview/web_test_create.py | 77 + .../web_test_create_basic.py | 77 + .../web_test_create_standard.py | 77 + .../v2018_05_01_preview/web_test_delete.py | 42 + .../v2018_05_01_preview/web_test_get.py | 43 + .../v2018_05_01_preview/web_test_list.py | 41 + .../web_test_list_by_component.py | 44 + .../web_test_list_by_resource_group.py | 43 + .../v2018_05_01_preview/web_test_update.py | 77 + .../web_test_update_tags_only.py | 44 + .../v2018_06_17_preview/workbook_add.py | 59 + .../v2018_06_17_preview/workbook_delete.py | 42 + .../v2018_06_17_preview/workbook_get.py | 43 + .../v2018_06_17_preview/workbook_update.py | 44 + .../v2018_06_17_preview/workbooks_list.py | 45 + .../workbook_template_add.py | 61 + .../workbook_template_delete.py | 42 + .../workbook_template_get.py | 43 + .../workbook_template_update.py | 43 + .../workbook_templates_list.py | 43 + .../v2020_02_02/components_create.py | 77 + .../{ => v2020_02_02}/components_delete.py | 2 +- .../{ => v2020_02_02}/components_get.py | 2 +- .../{ => v2020_02_02}/components_list.py | 2 +- .../components_list_by_resource_group.py | 2 +- .../{ => v2020_02_02}/components_purge.py | 2 +- .../components_purge_status.py | 2 +- .../v2020_02_02/components_update.py | 77 + .../components_update_tags_only.py | 44 + .../v2020_02_02_preview/components_create.py | 77 + .../v2020_02_02_preview/components_delete.py | 42 + .../v2020_02_02_preview/components_get.py | 43 + .../v2020_02_02_preview/components_list.py | 41 + .../components_list_by_resource_group.py | 43 + .../v2020_02_02_preview/components_purge.py | 47 + .../components_purge_status.py | 44 + .../v2020_02_02_preview/components_update.py | 77 + .../components_update_tags_only.py | 44 + ...nked_storage_accounts_create_and_update.py | 45 + ...omponent_linked_storage_accounts_delete.py | 2 +- .../component_linked_storage_accounts_get.py | 2 +- ...omponent_linked_storage_accounts_update.py | 45 + .../v2020_06_02_preview/live_token_get.py | 41 + .../v2020_06_02_preview/operations_list.py | 40 + .../workbook_template_add.py | 2 +- .../workbook_template_delete.py | 2 +- .../workbook_template_get.py | 2 +- .../workbook_template_update.py | 2 +- .../workbook_templates_list.py | 2 +- .../v2021_03_08/my_workbook_add.py | 56 + .../v2021_03_08/my_workbook_delete.py | 42 + .../v2021_03_08/my_workbook_get.py | 43 + .../v2021_03_08/my_workbook_update.py | 57 + .../v2021_03_08/my_workbooks_list.py | 44 + .../v2021_03_08/my_workbooks_list2.py | 44 + .../{ => v2021_08_01}/workbook_add.py | 4 +- .../{ => v2021_08_01}/workbook_delete.py | 4 +- .../v2021_08_01/workbook_get.py | 43 + .../{ => v2021_08_01}/workbook_get1.py | 4 +- .../{ => v2021_08_01}/workbook_managed_add.py | 4 +- .../{ => v2021_08_01}/workbook_managed_get.py | 4 +- .../workbook_managed_update.py | 4 +- .../workbook_revision_get.py | 4 +- .../workbook_revisions_list.py | 4 +- .../{ => v2021_08_01}/workbook_update.py | 4 +- .../v2021_08_01/workbooks_list.py | 44 + .../{ => v2021_08_01}/workbooks_list2.py | 4 +- .../{ => v2021_08_01}/workbooks_list_sub.py | 4 +- .../workbooks_managed_list.py | 4 +- .../{ => v2021_10}/live_token_get.py | 3 +- .../v2022_04_01/workbook_add.py | 54 + .../v2022_04_01/workbook_delete.py | 42 + .../v2022_04_01/workbook_get.py | 43 + .../v2022_04_01/workbook_get1.py | 43 + .../v2022_04_01/workbook_managed_add.py | 61 + .../v2022_04_01/workbook_managed_get.py | 43 + .../v2022_04_01/workbook_managed_update.py | 43 + .../v2022_04_01/workbook_revision_get.py | 44 + .../v2022_04_01/workbook_revisions_list.py | 44 + .../v2022_04_01/workbook_update.py | 43 + .../v2022_04_01/workbooks_list.py | 44 + .../v2022_04_01/workbooks_list2.py | 43 + .../v2022_04_01/workbooks_list_sub.py | 43 + .../v2022_04_01/workbooks_managed_list.py | 44 + .../v2022_06_15/web_test_create.py | 77 + .../v2022_06_15/web_test_create_standard.py | 77 + .../{ => v2022_06_15}/web_test_delete.py | 2 +- .../{ => v2022_06_15}/web_test_get.py | 2 +- .../{ => v2022_06_15}/web_test_list.py | 2 +- .../web_test_list_by_component.py | 2 +- .../web_test_list_by_resource_group.py | 2 +- .../v2022_06_15/web_test_update.py | 77 + .../v2022_06_15/web_test_update_tags_only.py | 44 + ...s_management_analytics_items_operations.py | 2 +- ...gement_analytics_items_operations_async.py | 2 +- ...ights_management_annotations_operations.py | 2 +- ...management_annotations_operations_async.py | 2 +- ...insights_management_api_keys_operations.py | 2 +- ...ts_management_api_keys_operations_async.py | 2 +- ...component_available_features_operations.py | 2 +- ...ent_available_features_operations_async.py | 2 +- ...ent_current_billing_features_operations.py | 2 +- ...rrent_billing_features_operations_async.py | 2 +- ...mponent_current_pricing_plan_operations.py | 79 + ...t_current_pricing_plan_operations_async.py | 80 + ...mponent_feature_capabilities_operations.py | 2 +- ...t_feature_capabilities_operations_async.py | 2 +- ...nent_linked_storage_accounts_operations.py | 2 +- ...inked_storage_accounts_operations_async.py | 2 +- ...ement_component_quota_status_operations.py | 2 +- ...component_quota_status_operations_async.py | 2 +- ...sights_management_components_operations.py | 2 +- ..._management_components_operations_async.py | 2 +- ...cription_list_migration_date_operations.py | 29 + ...on_list_migration_date_operations_async.py | 30 + ...migrate_to_new_pricing_model_operations.py | 29 + ...e_to_new_pricing_model_operations_async.py | 30 + ...back_to_legacy_pricing_model_operations.py | 29 + ...o_legacy_pricing_model_operations_async.py | 32 + ...gement_export_configurations_operations.py | 2 +- ..._export_configurations_operations_async.py | 2 +- ...nsights_management_favorites_operations.py | 2 +- ...s_management_favorites_operations_async.py | 2 +- ...sights_management_live_token_operations.py | 2 +- ..._management_live_token_operations_async.py | 2 +- ...ghts_management_my_workbooks_operations.py | 142 + ...anagement_my_workbooks_operations_async.py | 143 + ...lication_insights_management_operations.py | 4 +- ...on_insights_management_operations_async.py | 4 +- ...ive_detection_configurations_operations.py | 24 +- ...tection_configurations_operations_async.py | 24 +- ...anagement_web_test_locations_operations.py | 2 +- ...ent_web_test_locations_operations_async.py | 2 +- ...nsights_management_web_tests_operations.py | 2 +- ...s_management_web_tests_operations_async.py | 2 +- ...ent_work_item_configurations_operations.py | 2 +- ...rk_item_configurations_operations_async.py | 2 +- ...anagement_workbook_templates_operations.py | 2 +- ...ent_workbook_templates_operations_async.py | 2 +- ...nsights_management_workbooks_operations.py | 18 +- ...s_management_workbooks_operations_async.py | 18 +- .../pyproject.toml | 82 + .../sdk_packaging.toml | 8 - .../azure-mgmt-applicationinsights/setup.py | 82 - 610 files changed, 122703 insertions(+), 3595 deletions(-) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/apiview-properties.json create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/__init__.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/_application_insights_management_client.py (72%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/_configuration.py (79%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{aio => v2015_05_01}/_patch.py (89%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/_utils/__init__.py (100%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/_utils/serialization.py (98%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_version.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/__init__.py (100%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/_application_insights_management_client.py (72%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/_configuration.py (79%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{aio/operations => v2015_05_01/aio}/_patch.py (89%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/__init__.py (84%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_analytics_items_operations.py (92%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_annotations_operations.py (88%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_api_keys_operations.py (90%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_component_available_features_operations.py (92%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_component_current_billing_features_operations.py (91%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_component_feature_capabilities_operations.py (92%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_component_quota_status_operations.py (92%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_components_operations.py (87%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_export_configurations_operations.py (91%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_favorites_operations.py (92%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_my_workbooks_operations.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_operations.py (80%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{models => v2015_05_01/aio/operations}/_patch.py (89%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_proactive_detection_configurations_operations.py (92%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_web_test_locations_operations.py (83%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_tests_operations.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/aio/operations/_work_item_configurations_operations.py (90%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_workbooks_operations.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/models/__init__.py (63%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/models/_application_insights_management_client_enums.py (69%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/models/_models_py3.py (55%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{operations => v2015_05_01/models}/_patch.py (89%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/__init__.py (84%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_analytics_items_operations.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_annotations_operations.py (91%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_api_keys_operations.py (92%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_component_available_features_operations.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_component_current_billing_features_operations.py (92%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_component_feature_capabilities_operations.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_component_quota_status_operations.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_components_operations.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_export_configurations_operations.py (93%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_favorites_operations.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_my_workbooks_operations.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_operations.py (80%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_patch.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_proactive_detection_configurations_operations.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_web_test_locations_operations.py (86%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_tests_operations.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/operations/_work_item_configurations_operations.py (93%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_workbooks_operations.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2015_05_01}/py.typed (100%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_component_current_pricing_plan_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_list_migration_date_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_component_current_pricing_plan_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_list_migration_date_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_components_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_proactive_detection_configurations_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_web_tests_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_application_insights_management_client_enums.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_components_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_proactive_detection_configurations_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_web_tests_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/__init__.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{aio/operations/_deleted_workbooks_operations.py => v2018_06_17_preview/aio/operations/_operations.py} (69%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_workbooks_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_application_insights_management_client_enums.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/__init__.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{operations/_deleted_workbooks_operations.py => v2018_06_17_preview/operations/_operations.py} (64%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_workbooks_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_workbook_templates_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_workbook_templates_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_components_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_application_insights_management_client_enums.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/__init__.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2020_02_02}/operations/_components_operations.py (89%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_components_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_application_insights_management_client_enums.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_components_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/__init__.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2020_03_01_preview}/aio/operations/_component_linked_storage_accounts_operations.py (86%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_application_insights_management_client_enums.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/__init__.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2020_03_01_preview}/operations/_component_linked_storage_accounts_operations.py (89%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_live_token_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_live_token_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_patch.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2020_11_20}/aio/operations/_workbook_templates_operations.py (86%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_patch.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2020_11_20}/operations/_workbook_templates_operations.py (89%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_my_workbooks_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_application_insights_management_client_enums.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_my_workbooks_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_workbooks_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_application_insights_management_client_enums.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_workbooks_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/__init__.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2021_10}/aio/operations/_live_token_operations.py (89%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/__init__.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2021_10}/operations/_live_token_operations.py (91%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_patch.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2022_04_01}/aio/operations/_workbooks_operations.py (83%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_application_insights_management_client_enums.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_patch.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2022_04_01}/operations/_workbooks_operations.py (86%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/serialization.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_version.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_application_insights_management_client.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_configuration.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_patch.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2022_06_15}/aio/operations/_web_tests_operations.py (87%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_application_insights_management_client_enums.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_models_py3.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_patch.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_patch.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{ => v2022_06_15}/operations/_web_tests_operations.py (90%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/code_report_swagger.json rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/analytics_item_delete.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/analytics_item_get.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/analytics_item_list.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/analytics_item_put.py (96%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_create.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/annotations_delete.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/annotations_get.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/annotations_list.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/api_keys_create.py (95%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/api_keys_delete.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/api_keys_get.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/api_keys_list.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/available_billing_features_get.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_create.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_delete.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list_by_resource_group.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge_status.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update_tags_only.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/current_billing_features_get.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_update.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/export_configuration_delete.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/export_configuration_get.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_update.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/export_configurations_list.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_post.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/favorite_add.py (98%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/favorite_delete.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/favorite_get.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/favorite_update.py (98%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/favorites_list.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/feature_capabilities_get.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_add.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_delete.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbooks_list.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/proactive_detection_configuration_get.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_update.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/proactive_detection_configurations_list.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/quota_status_get.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_create.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_delete.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_component.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_resource_group.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/web_test_locations_list.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update_tags_only.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_create.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/work_item_config_default_get.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/work_item_config_delete.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/work_item_config_get.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_update.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/work_item_configs_get.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_add.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_delete.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/workbook_get.py (90%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_update.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2015_05_01}/workbooks_list.py (90%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_create_and_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_list_migration_date.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_migrate_to_new_pricing_model_post.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_rollback_to_legacy_pricing_model_post.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_create.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_delete.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list_by_resource_group.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge_status.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update_tags_only.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{deleted_workbooks_list.py => v2018_05_01_preview/operations_list.py} (79%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configurations_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_basic.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_standard.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_delete.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_component.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_resource_group.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update_tags_only.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_add.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_delete.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbooks_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_add.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_delete.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_templates_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_create.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_02_02}/components_delete.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_02_02}/components_get.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_02_02}/components_list.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_02_02}/components_list_by_resource_group.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_02_02}/components_purge.py (95%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_02_02}/components_purge_status.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update_tags_only.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_create.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_delete.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list_by_resource_group.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge_status.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update_tags_only.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_create_and_update.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_03_01_preview}/component_linked_storage_accounts_delete.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_03_01_preview}/component_linked_storage_accounts_get.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/live_token_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/operations_list.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_11_20}/workbook_template_add.py (97%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_11_20}/workbook_template_delete.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_11_20}/workbook_template_get.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_11_20}/workbook_template_update.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2020_11_20}/workbook_templates_list.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_add.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_delete.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list2.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbook_add.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbook_delete.py (90%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbook_get1.py (90%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbook_managed_add.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbook_managed_get.py (90%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbook_managed_update.py (90%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbook_revision_get.py (91%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbook_revisions_list.py (91%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbook_update.py (90%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbooks_list2.py (90%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbooks_list_sub.py (90%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_08_01}/workbooks_managed_list.py (91%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2021_10}/live_token_get.py (93%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_add.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_delete.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get1.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_add.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revision_get.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revisions_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list2.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list_sub.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_managed_list.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create_standard.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2022_06_15}/web_test_delete.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2022_06_15}/web_test_get.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2022_06_15}/web_test_list.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2022_06_15}/web_test_list_by_component.py (94%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{ => v2022_06_15}/web_test_list_by_resource_group.py (94%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update_tags_only.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations_async.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations_async.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations_async.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations_async.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations_async.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/sdk_packaging.toml delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/setup.py diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/CHANGELOG.md b/sdk/applicationinsights/azure-mgmt-applicationinsights/CHANGELOG.md index 10d3f873dff6..613dedac4ae3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/CHANGELOG.md +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 5.0.0b2 (2026-03-26) + +skip changelog generation + ## 5.0.0b1 (2025-07-24) ### Features Added diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/MANIFEST.in b/sdk/applicationinsights/azure-mgmt-applicationinsights/MANIFEST.in index 40a607da101a..545801296d7d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/MANIFEST.in +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/MANIFEST.in @@ -1,7 +1,7 @@ -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/applicationinsights/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/_metadata.json b/sdk/applicationinsights/azure-mgmt-applicationinsights/_metadata.json index dfb747115ef2..731c163a4bba 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/_metadata.json +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/_metadata.json @@ -1,11 +1,11 @@ { - "commit": "b03475447ff6b3bcccfd25e99609b63bb2877b09", + "commit": "5ce63776b93010e2ef6ba8d14b79b3b95bdc47d6", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.35.0", + "@autorest/python@6.50.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/applicationinsights/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 --use=@autorest/python@6.35.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/applicationinsights/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=/home/v-chenjiang/worktrees/sdk-azure-mgmt-applicationinsights/sdk --use=@autorest/python@6.50.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/applicationinsights/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/apiview-properties.json b/sdk/applicationinsights/azure-mgmt-applicationinsights/apiview-properties.json new file mode 100644 index 000000000000..fdfc3cb7444d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/apiview-properties.json @@ -0,0 +1,30 @@ +{ + "CrossLanguagePackageId": null, + "CrossLanguageDefinitionId": { + "azure.mgmt.applicationinsights.v2022_06_15.models.HeaderField": null, + "azure.mgmt.applicationinsights.v2022_06_15.models.TagsResource": null, + "azure.mgmt.applicationinsights.v2022_06_15.models.WebtestsResource": null, + "azure.mgmt.applicationinsights.v2022_06_15.models.WebTest": null, + "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestGeolocation": null, + "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestListResult": null, + "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesConfiguration": null, + "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesRequest": null, + "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRules": null, + "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRulesContentValidation": null, + "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestKind": null, + "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.list_by_resource_group": null, + "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.list_by_resource_group": null, + "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.get": null, + "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.get": null, + "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.create_or_update": null, + "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.create_or_update": null, + "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.update_tags": null, + "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.update_tags": null, + "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.delete": null, + "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.delete": null, + "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.list": null, + "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.list": null, + "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.list_by_component": null, + "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.list_by_component": null + } +} \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/__init__.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/__init__.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/__init__.py index da2ffef86618..35bb7b7a2fb1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/__init__.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/__init__.py @@ -1,32 +1,2 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore from ._version import VERSION - __version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_patch.py index 8bcb627aa475..20806156e442 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_patch.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_patch.py @@ -1,21 +1,2 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - 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 - """ + pass diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_version.py index 3f948557870d..57e0ad763159 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_version.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_version.py @@ -1,8 +1 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -VERSION = "5.0.0b1" +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_application_insights_management_client.py similarity index 72% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_application_insights_management_client.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_application_insights_management_client.py index 33a85b2fc75d..f90c2040f13e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_application_insights_management_client.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_application_insights_management_client.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -28,98 +27,106 @@ ComponentAvailableFeaturesOperations, ComponentCurrentBillingFeaturesOperations, ComponentFeatureCapabilitiesOperations, - ComponentLinkedStorageAccountsOperations, ComponentQuotaStatusOperations, ComponentsOperations, - DeletedWorkbooksOperations, ExportConfigurationsOperations, FavoritesOperations, - LiveTokenOperations, + MyWorkbooksOperations, Operations, ProactiveDetectionConfigurationsOperations, WebTestLocationsOperations, WebTestsOperations, WorkItemConfigurationsOperations, - WorkbookTemplatesOperations, WorkbooksOperations, ) if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class ApplicationInsightsManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class ApplicationInsightsManagementClient: # pylint: disable=too-many-instance-attributes """Composite Swagger for Application Insights Management Client. - :ivar components: ComponentsOperations operations - :vartype components: azure.mgmt.applicationinsights.operations.ComponentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.applicationinsights.v2015_05_01.operations.Operations :ivar annotations: AnnotationsOperations operations - :vartype annotations: azure.mgmt.applicationinsights.operations.AnnotationsOperations + :vartype annotations: + azure.mgmt.applicationinsights.v2015_05_01.operations.AnnotationsOperations :ivar api_keys: APIKeysOperations operations - :vartype api_keys: azure.mgmt.applicationinsights.operations.APIKeysOperations + :vartype api_keys: azure.mgmt.applicationinsights.v2015_05_01.operations.APIKeysOperations :ivar export_configurations: ExportConfigurationsOperations operations :vartype export_configurations: - azure.mgmt.applicationinsights.operations.ExportConfigurationsOperations + azure.mgmt.applicationinsights.v2015_05_01.operations.ExportConfigurationsOperations :ivar component_current_billing_features: ComponentCurrentBillingFeaturesOperations operations :vartype component_current_billing_features: - azure.mgmt.applicationinsights.operations.ComponentCurrentBillingFeaturesOperations + azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentCurrentBillingFeaturesOperations :ivar component_quota_status: ComponentQuotaStatusOperations operations :vartype component_quota_status: - azure.mgmt.applicationinsights.operations.ComponentQuotaStatusOperations + azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentQuotaStatusOperations :ivar component_feature_capabilities: ComponentFeatureCapabilitiesOperations operations :vartype component_feature_capabilities: - azure.mgmt.applicationinsights.operations.ComponentFeatureCapabilitiesOperations + azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentFeatureCapabilitiesOperations :ivar component_available_features: ComponentAvailableFeaturesOperations operations :vartype component_available_features: - azure.mgmt.applicationinsights.operations.ComponentAvailableFeaturesOperations + azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentAvailableFeaturesOperations :ivar proactive_detection_configurations: ProactiveDetectionConfigurationsOperations operations :vartype proactive_detection_configurations: - azure.mgmt.applicationinsights.operations.ProactiveDetectionConfigurationsOperations + azure.mgmt.applicationinsights.v2015_05_01.operations.ProactiveDetectionConfigurationsOperations + :ivar components: ComponentsOperations operations + :vartype components: azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentsOperations :ivar work_item_configurations: WorkItemConfigurationsOperations operations :vartype work_item_configurations: - azure.mgmt.applicationinsights.operations.WorkItemConfigurationsOperations + azure.mgmt.applicationinsights.v2015_05_01.operations.WorkItemConfigurationsOperations :ivar favorites: FavoritesOperations operations - :vartype favorites: azure.mgmt.applicationinsights.operations.FavoritesOperations + :vartype favorites: azure.mgmt.applicationinsights.v2015_05_01.operations.FavoritesOperations :ivar web_test_locations: WebTestLocationsOperations operations :vartype web_test_locations: - azure.mgmt.applicationinsights.operations.WebTestLocationsOperations + azure.mgmt.applicationinsights.v2015_05_01.operations.WebTestLocationsOperations :ivar web_tests: WebTestsOperations operations - :vartype web_tests: azure.mgmt.applicationinsights.operations.WebTestsOperations + :vartype web_tests: azure.mgmt.applicationinsights.v2015_05_01.operations.WebTestsOperations :ivar analytics_items: AnalyticsItemsOperations operations - :vartype analytics_items: azure.mgmt.applicationinsights.operations.AnalyticsItemsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.applicationinsights.operations.Operations - :ivar workbook_templates: WorkbookTemplatesOperations operations - :vartype workbook_templates: - azure.mgmt.applicationinsights.operations.WorkbookTemplatesOperations + :vartype analytics_items: + azure.mgmt.applicationinsights.v2015_05_01.operations.AnalyticsItemsOperations :ivar workbooks: WorkbooksOperations operations - :vartype workbooks: azure.mgmt.applicationinsights.operations.WorkbooksOperations - :ivar live_token: LiveTokenOperations operations - :vartype live_token: azure.mgmt.applicationinsights.operations.LiveTokenOperations - :ivar component_linked_storage_accounts: ComponentLinkedStorageAccountsOperations operations - :vartype component_linked_storage_accounts: - azure.mgmt.applicationinsights.operations.ComponentLinkedStorageAccountsOperations - :ivar deleted_workbooks: DeletedWorkbooksOperations operations - :vartype deleted_workbooks: - azure.mgmt.applicationinsights.operations.DeletedWorkbooksOperations + :vartype workbooks: azure.mgmt.applicationinsights.v2015_05_01.operations.WorkbooksOperations + :ivar my_workbooks: MyWorkbooksOperations operations + :vartype my_workbooks: + azure.mgmt.applicationinsights.v2015_05_01.operations.MyWorkbooksOperations :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 None. :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2015-05-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: Optional[str] = None, **kwargs: Any + self, + credential: "TokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) _policies = kwargs.pop("policies", None) @@ -146,7 +153,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.annotations = AnnotationsOperations(self._client, self._config, self._serialize, self._deserialize) self.api_keys = APIKeysOperations(self._client, self._config, self._serialize, self._deserialize) self.export_configurations = ExportConfigurationsOperations( @@ -167,6 +174,7 @@ def __init__( self.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.work_item_configurations = WorkItemConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -176,18 +184,8 @@ def __init__( ) self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) self.analytics_items = AnalyticsItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.workbook_templates = WorkbookTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) - self.component_linked_storage_accounts = ComponentLinkedStorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.deleted_workbooks = DeletedWorkbooksOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.my_workbooks = MyWorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_configuration.py similarity index 79% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_configuration.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_configuration.py index 5770b52de287..320522510ff1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_configuration.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,6 +14,7 @@ from ._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential @@ -27,9 +28,23 @@ class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-m :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2015-05-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: + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2015-05-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -37,6 +52,8 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.cloud_setting = cloud_setting + self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_patch.py similarity index 89% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_patch.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_patch.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/__init__.py similarity index 100% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/__init__.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/__init__.py diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/serialization.py similarity index 98% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/serialization.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/serialization.py index f5187701d7be..6da830e0cf4a 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/serialization.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/serialization.py @@ -21,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -31,7 +30,6 @@ Mapping, Callable, MutableMapping, - List, ) try: @@ -229,12 +227,12 @@ class Model: serialization and deserialization. """ - _subtype_map: Dict[str, Dict[str, Any]] = {} - _attribute_map: Dict[str, Dict[str, Any]] = {} - _validation: Dict[str, Dict[str, Any]] = {} + _subtype_map: dict[str, dict[str, Any]] = {} + _attribute_map: dict[str, dict[str, Any]] = {} + _validation: dict[str, dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Optional[Dict[str, Any]] = {} + self.additional_properties: Optional[dict[str, Any]] = {} for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -311,7 +309,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: 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. @@ -380,7 +378,7 @@ def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: def from_dict( cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, ) -> Self: """Parse a dict using given key extractor return a model. @@ -414,7 +412,7 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod @@ -528,7 +526,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = 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 @@ -579,7 +577,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -789,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -823,13 +821,20 @@ def serialize_basic(cls, data, data_type, **kwargs): :param str data_type: Type of object in the iterable. :rtype: str, int, float, bool :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): @@ -1184,7 +1189,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1386,7 +1391,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = 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 @@ -1759,7 +1764,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises TypeError: if string format is not valid. + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1785,7 +1790,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/__init__.py similarity index 100% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/__init__.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/__init__.py diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_application_insights_management_client.py similarity index 72% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_application_insights_management_client.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_application_insights_management_client.py index ead873c2885e..f55abce49908 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_application_insights_management_client.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_application_insights_management_client.py @@ -1,4 +1,3 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -28,99 +27,110 @@ ComponentAvailableFeaturesOperations, ComponentCurrentBillingFeaturesOperations, ComponentFeatureCapabilitiesOperations, - ComponentLinkedStorageAccountsOperations, ComponentQuotaStatusOperations, ComponentsOperations, - DeletedWorkbooksOperations, ExportConfigurationsOperations, FavoritesOperations, - LiveTokenOperations, + MyWorkbooksOperations, Operations, ProactiveDetectionConfigurationsOperations, WebTestLocationsOperations, WebTestsOperations, WorkItemConfigurationsOperations, - WorkbookTemplatesOperations, WorkbooksOperations, ) if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class ApplicationInsightsManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class ApplicationInsightsManagementClient: # pylint: disable=too-many-instance-attributes """Composite Swagger for Application Insights Management Client. - :ivar components: ComponentsOperations operations - :vartype components: azure.mgmt.applicationinsights.aio.operations.ComponentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.applicationinsights.v2015_05_01.aio.operations.Operations :ivar annotations: AnnotationsOperations operations - :vartype annotations: azure.mgmt.applicationinsights.aio.operations.AnnotationsOperations + :vartype annotations: + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.AnnotationsOperations :ivar api_keys: APIKeysOperations operations - :vartype api_keys: azure.mgmt.applicationinsights.aio.operations.APIKeysOperations + :vartype api_keys: azure.mgmt.applicationinsights.v2015_05_01.aio.operations.APIKeysOperations :ivar export_configurations: ExportConfigurationsOperations operations :vartype export_configurations: - azure.mgmt.applicationinsights.aio.operations.ExportConfigurationsOperations + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ExportConfigurationsOperations :ivar component_current_billing_features: ComponentCurrentBillingFeaturesOperations operations :vartype component_current_billing_features: - azure.mgmt.applicationinsights.aio.operations.ComponentCurrentBillingFeaturesOperations + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ComponentCurrentBillingFeaturesOperations :ivar component_quota_status: ComponentQuotaStatusOperations operations :vartype component_quota_status: - azure.mgmt.applicationinsights.aio.operations.ComponentQuotaStatusOperations + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ComponentQuotaStatusOperations :ivar component_feature_capabilities: ComponentFeatureCapabilitiesOperations operations :vartype component_feature_capabilities: - azure.mgmt.applicationinsights.aio.operations.ComponentFeatureCapabilitiesOperations + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ComponentFeatureCapabilitiesOperations :ivar component_available_features: ComponentAvailableFeaturesOperations operations :vartype component_available_features: - azure.mgmt.applicationinsights.aio.operations.ComponentAvailableFeaturesOperations + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ComponentAvailableFeaturesOperations :ivar proactive_detection_configurations: ProactiveDetectionConfigurationsOperations operations :vartype proactive_detection_configurations: - azure.mgmt.applicationinsights.aio.operations.ProactiveDetectionConfigurationsOperations + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ProactiveDetectionConfigurationsOperations + :ivar components: ComponentsOperations operations + :vartype components: + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ComponentsOperations :ivar work_item_configurations: WorkItemConfigurationsOperations operations :vartype work_item_configurations: - azure.mgmt.applicationinsights.aio.operations.WorkItemConfigurationsOperations + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.WorkItemConfigurationsOperations :ivar favorites: FavoritesOperations operations - :vartype favorites: azure.mgmt.applicationinsights.aio.operations.FavoritesOperations + :vartype favorites: + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.FavoritesOperations :ivar web_test_locations: WebTestLocationsOperations operations :vartype web_test_locations: - azure.mgmt.applicationinsights.aio.operations.WebTestLocationsOperations + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.WebTestLocationsOperations :ivar web_tests: WebTestsOperations operations - :vartype web_tests: azure.mgmt.applicationinsights.aio.operations.WebTestsOperations + :vartype web_tests: + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.WebTestsOperations :ivar analytics_items: AnalyticsItemsOperations operations :vartype analytics_items: - azure.mgmt.applicationinsights.aio.operations.AnalyticsItemsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.applicationinsights.aio.operations.Operations - :ivar workbook_templates: WorkbookTemplatesOperations operations - :vartype workbook_templates: - azure.mgmt.applicationinsights.aio.operations.WorkbookTemplatesOperations + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.AnalyticsItemsOperations :ivar workbooks: WorkbooksOperations operations - :vartype workbooks: azure.mgmt.applicationinsights.aio.operations.WorkbooksOperations - :ivar live_token: LiveTokenOperations operations - :vartype live_token: azure.mgmt.applicationinsights.aio.operations.LiveTokenOperations - :ivar component_linked_storage_accounts: ComponentLinkedStorageAccountsOperations operations - :vartype component_linked_storage_accounts: - azure.mgmt.applicationinsights.aio.operations.ComponentLinkedStorageAccountsOperations - :ivar deleted_workbooks: DeletedWorkbooksOperations operations - :vartype deleted_workbooks: - azure.mgmt.applicationinsights.aio.operations.DeletedWorkbooksOperations + :vartype workbooks: + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.WorkbooksOperations + :ivar my_workbooks: MyWorkbooksOperations operations + :vartype my_workbooks: + azure.mgmt.applicationinsights.v2015_05_01.aio.operations.MyWorkbooksOperations :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 None. :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2015-05-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: Optional[str] = None, **kwargs: Any + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) _policies = kwargs.pop("policies", None) @@ -149,7 +159,7 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.annotations = AnnotationsOperations(self._client, self._config, self._serialize, self._deserialize) self.api_keys = APIKeysOperations(self._client, self._config, self._serialize, self._deserialize) self.export_configurations = ExportConfigurationsOperations( @@ -170,6 +180,7 @@ def __init__( self.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.work_item_configurations = WorkItemConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -179,18 +190,8 @@ def __init__( ) self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) self.analytics_items = AnalyticsItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.workbook_templates = WorkbookTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) - self.component_linked_storage_accounts = ComponentLinkedStorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.deleted_workbooks = DeletedWorkbooksOperations( - self._client, self._config, self._serialize, self._deserialize - ) + self.my_workbooks = MyWorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_configuration.py similarity index 79% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_configuration.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_configuration.py index db231e2038ef..c3d3836541e3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_configuration.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_configuration.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,6 +14,7 @@ from .._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential @@ -27,9 +28,23 @@ class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-m :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2015-05-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: + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2015-05-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -37,6 +52,8 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.cloud_setting = cloud_setting + self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_patch.py similarity index 89% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_patch.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_patch.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/__init__.py similarity index 84% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/__init__.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/__init__.py index be555323ff9d..a6e31fd3e1fd 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/__init__.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/__init__.py @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._components_operations import ComponentsOperations # type: ignore +from ._operations import Operations # type: ignore from ._annotations_operations import AnnotationsOperations # type: ignore from ._api_keys_operations import APIKeysOperations # type: ignore from ._export_configurations_operations import ExportConfigurationsOperations # type: ignore @@ -21,24 +21,21 @@ from ._component_feature_capabilities_operations import ComponentFeatureCapabilitiesOperations # type: ignore from ._component_available_features_operations import ComponentAvailableFeaturesOperations # type: ignore from ._proactive_detection_configurations_operations import ProactiveDetectionConfigurationsOperations # type: ignore +from ._components_operations import ComponentsOperations # type: ignore from ._work_item_configurations_operations import WorkItemConfigurationsOperations # type: ignore from ._favorites_operations import FavoritesOperations # type: ignore from ._web_test_locations_operations import WebTestLocationsOperations # type: ignore from ._web_tests_operations import WebTestsOperations # type: ignore from ._analytics_items_operations import AnalyticsItemsOperations # type: ignore -from ._operations import Operations # type: ignore -from ._workbook_templates_operations import WorkbookTemplatesOperations # type: ignore from ._workbooks_operations import WorkbooksOperations # type: ignore -from ._live_token_operations import LiveTokenOperations # type: ignore -from ._component_linked_storage_accounts_operations import ComponentLinkedStorageAccountsOperations # type: ignore -from ._deleted_workbooks_operations import DeletedWorkbooksOperations # type: ignore +from ._my_workbooks_operations import MyWorkbooksOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ComponentsOperations", + "Operations", "AnnotationsOperations", "APIKeysOperations", "ExportConfigurationsOperations", @@ -47,17 +44,14 @@ "ComponentFeatureCapabilitiesOperations", "ComponentAvailableFeaturesOperations", "ProactiveDetectionConfigurationsOperations", + "ComponentsOperations", "WorkItemConfigurationsOperations", "FavoritesOperations", "WebTestLocationsOperations", "WebTestsOperations", "AnalyticsItemsOperations", - "Operations", - "WorkbookTemplatesOperations", "WorkbooksOperations", - "LiveTokenOperations", - "ComponentLinkedStorageAccountsOperations", - "DeletedWorkbooksOperations", + "MyWorkbooksOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_analytics_items_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_analytics_items_operations.py similarity index 92% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_analytics_items_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_analytics_items_operations.py index 3153e30fb9ab..fc97a948c436 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_analytics_items_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_analytics_items_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -35,7 +35,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class AnalyticsItemsOperations: @@ -44,7 +45,7 @@ class AnalyticsItemsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`analytics_items` attribute. """ @@ -80,19 +81,20 @@ async def list( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param scope: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "shared" and "user". Default value is None. - :type scope: str or ~azure.mgmt.applicationinsights.models.ItemScope + :type scope: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScope :param type: Enum indicating the type of the Analytics item. Known values are: "none", "query", "function", "folder", and "recent". Default value is "none". - :type type: str or ~azure.mgmt.applicationinsights.models.ItemTypeParameter + :type type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemTypeParameter :param include_content: Flag indicating whether or not to return the content of each applicable item. If false, only return the item information. Default value is None. :type include_content: bool :return: list of ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem] + :rtype: + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -106,7 +108,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.ApplicationInsightsComponentAnalyticsItem]] = kwargs.pop("cls", None) _request = build_list_request( @@ -161,7 +163,7 @@ async def get( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param id: The Id of a specific item defined in the Application Insights component. Default value is None. :type id: str @@ -169,7 +171,8 @@ async def get( value is None. :type name: str :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -183,7 +186,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) _request = build_get_request( @@ -239,11 +242,11 @@ async def put( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param item_properties: Properties that need to be specified to create a new item and add it to an Application Insights component. Required. :type item_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem :param override_item: Flag indicating whether or not to force save an item. This allows overriding an item if it already exists. Default value is None. :type override_item: bool @@ -251,7 +254,8 @@ async def put( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem :raises ~azure.core.exceptions.HttpResponseError: """ @@ -277,7 +281,7 @@ async def put( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param item_properties: Properties that need to be specified to create a new item and add it to an Application Insights component. Required. :type item_properties: IO[bytes] @@ -288,7 +292,8 @@ async def put( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem :raises ~azure.core.exceptions.HttpResponseError: """ @@ -312,17 +317,19 @@ async def put( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param item_properties: Properties that need to be specified to create a new item and add it to an Application Insights component. Is either a ApplicationInsightsComponentAnalyticsItem type or a IO[bytes] type. Required. :type item_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem or + IO[bytes] :param override_item: Flag indicating whether or not to force save an item. This allows overriding an item if it already exists. Default value is None. :type override_item: bool :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -336,7 +343,7 @@ async def put( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) @@ -401,7 +408,7 @@ async def delete( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param id: The Id of a specific item defined in the Application Insights component. Default value is None. :type id: str @@ -423,7 +430,7 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_annotations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_annotations_operations.py similarity index 88% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_annotations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_annotations_operations.py index 9dd110a0dc8c..38f89b3fc862 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_annotations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_annotations_operations.py @@ -7,7 +7,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -37,7 +38,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class AnnotationsOperations: @@ -46,7 +48,7 @@ class AnnotationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`annotations` attribute. """ @@ -79,13 +81,13 @@ def list( :type end: str :return: An iterator like instance of either Annotation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.Annotation] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] :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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AnnotationsListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -112,7 +114,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -135,7 +148,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.AnnotationError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.AnnotationError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -161,12 +177,12 @@ async def create( :type resource_name: str :param annotation_properties: Properties that need to be specified to create an annotation of a Application Insights component. Required. - :type annotation_properties: ~azure.mgmt.applicationinsights.models.Annotation + :type annotation_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -194,7 +210,7 @@ async def create( Default value is "application/json". :paramtype content_type: str :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -215,9 +231,10 @@ async def create( :type resource_name: str :param annotation_properties: Properties that need to be specified to create an annotation of a Application Insights component. Is either a Annotation type or a IO[bytes] type. Required. - :type annotation_properties: ~azure.mgmt.applicationinsights.models.Annotation or IO[bytes] + :type annotation_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation or + IO[bytes] :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -231,7 +248,7 @@ async def create( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) @@ -265,7 +282,10 @@ async def create( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.AnnotationError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.AnnotationError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("[Annotation]", pipeline_response.http_response) @@ -302,7 +322,7 @@ async def delete(self, resource_group_name: str, resource_name: str, annotation_ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -345,7 +365,7 @@ async def get( component. Required. :type annotation_id: str :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -359,7 +379,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) _request = build_get_request( @@ -382,7 +402,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.AnnotationError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.AnnotationError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("[Annotation]", pipeline_response.http_response) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_api_keys_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_api_keys_operations.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_api_keys_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_api_keys_operations.py index dbfb34d0ac7f..60c32309b6f1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_api_keys_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_api_keys_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,7 +39,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class APIKeysOperations: @@ -47,7 +49,7 @@ class APIKeysOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`api_keys` attribute. """ @@ -76,13 +78,13 @@ def list( :return: An iterator like instance of either ApplicationInsightsComponentAPIKey or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey] :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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentAPIKeyListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -107,7 +109,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -155,12 +168,12 @@ async def create( :type resource_name: str :param api_key_properties: Properties that need to be specified to create an API key of a Application Insights component. Required. - :type api_key_properties: ~azure.mgmt.applicationinsights.models.APIKeyRequest + :type api_key_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.APIKeyRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey :raises ~azure.core.exceptions.HttpResponseError: """ @@ -188,7 +201,7 @@ async def create( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey :raises ~azure.core.exceptions.HttpResponseError: """ @@ -209,9 +222,10 @@ async def create( :type resource_name: str :param api_key_properties: Properties that need to be specified to create an API key of a Application Insights component. Is either a APIKeyRequest type or a IO[bytes] type. Required. - :type api_key_properties: ~azure.mgmt.applicationinsights.models.APIKeyRequest or IO[bytes] + :type api_key_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.APIKeyRequest or + IO[bytes] :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -225,7 +239,7 @@ async def create( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) @@ -283,7 +297,7 @@ async def delete( Required. :type key_id: str :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -297,7 +311,7 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) _request = build_delete_request( @@ -344,7 +358,7 @@ async def get( Required. :type key_id: str :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -358,7 +372,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) _request = build_get_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_available_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_available_features_operations.py similarity index 92% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_available_features_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_available_features_operations.py index b6a73eeaf7cc..4d7011391cab 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_available_features_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_available_features_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -29,7 +29,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ComponentAvailableFeaturesOperations: @@ -38,7 +39,7 @@ class ComponentAvailableFeaturesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`component_available_features` attribute. """ @@ -65,7 +66,8 @@ async def get( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: ApplicationInsightsComponentAvailableFeatures or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAvailableFeatures + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAvailableFeatures :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -79,7 +81,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentAvailableFeatures] = kwargs.pop("cls", None) _request = build_get_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_current_billing_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_current_billing_features_operations.py similarity index 91% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_current_billing_features_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_current_billing_features_operations.py index 4700f24d87da..a54b4e28912e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_current_billing_features_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_current_billing_features_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -30,7 +30,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ComponentCurrentBillingFeaturesOperations: # pylint: disable=name-too-long @@ -39,7 +40,7 @@ class ComponentCurrentBillingFeaturesOperations: # pylint: disable=name-too-lon **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`component_current_billing_features` attribute. """ @@ -66,7 +67,8 @@ async def get( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -80,7 +82,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) _request = build_get_request( @@ -131,12 +133,13 @@ async def update( :param billing_features_properties: Properties that need to be specified to update billing features for an Application Insights component. Required. :type billing_features_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures :raises ~azure.core.exceptions.HttpResponseError: """ @@ -164,7 +167,8 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures :raises ~azure.core.exceptions.HttpResponseError: """ @@ -187,9 +191,11 @@ async def update( features for an Application Insights component. Is either a ApplicationInsightsComponentBillingFeatures type or a IO[bytes] type. Required. :type billing_features_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures + or IO[bytes] :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -203,7 +209,7 @@ async def update( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_feature_capabilities_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_feature_capabilities_operations.py similarity index 92% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_feature_capabilities_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_feature_capabilities_operations.py index 3c8d4ae5281d..5ff34841b547 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_feature_capabilities_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_feature_capabilities_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -29,7 +29,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ComponentFeatureCapabilitiesOperations: @@ -38,7 +39,7 @@ class ComponentFeatureCapabilitiesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`component_feature_capabilities` attribute. """ @@ -65,7 +66,8 @@ async def get( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: ApplicationInsightsComponentFeatureCapabilities or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeatureCapabilities + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFeatureCapabilities :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -79,7 +81,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentFeatureCapabilities] = kwargs.pop("cls", None) _request = build_get_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_quota_status_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_quota_status_operations.py similarity index 92% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_quota_status_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_quota_status_operations.py index 8ce91316d5e2..73ad86ae04b1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_quota_status_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_quota_status_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -29,7 +29,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ComponentQuotaStatusOperations: @@ -38,7 +39,7 @@ class ComponentQuotaStatusOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`component_quota_status` attribute. """ @@ -65,7 +66,8 @@ async def get( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: ApplicationInsightsComponentQuotaStatus or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentQuotaStatus + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentQuotaStatus :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -79,7 +81,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentQuotaStatus] = kwargs.pop("cls", None) _request = build_get_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_components_operations.py similarity index 87% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_components_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_components_operations.py index c3e4b45480e7..aba304c5ca97 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_components_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_components_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -41,7 +43,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ComponentsOperations: @@ -50,7 +53,7 @@ class ComponentsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`components` attribute. """ @@ -72,13 +75,13 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ApplicationInsightsComp :return: An iterator like instance of either ApplicationInsightsComponent or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] :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", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -101,7 +104,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -124,8 +138,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) return pipeline_response @@ -143,13 +156,13 @@ def list_by_resource_group( :return: An iterator like instance of either ApplicationInsightsComponent or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] :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", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -173,7 +186,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -196,8 +220,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) return pipeline_response @@ -227,7 +250,7 @@ async def delete(self, resource_group_name: str, resource_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -249,8 +272,7 @@ async def delete(self, resource_group_name: str, resource_name: str, **kwargs: A if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) # type: ignore @@ -267,7 +289,7 @@ async def get( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -281,7 +303,7 @@ 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", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) _request = build_get_request( @@ -303,8 +325,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) @@ -333,12 +354,13 @@ async def create_or_update( :type resource_name: str :param insight_properties: Properties that need to be specified to create an Application Insights component. Required. - :type insight_properties: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :type insight_properties: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ @@ -367,7 +389,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ @@ -390,10 +412,10 @@ async def create_or_update( :param insight_properties: Properties that need to be specified to create an Application Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. Required. - :type insight_properties: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent - or IO[bytes] + :type insight_properties: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent or IO[bytes] :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -407,7 +429,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) @@ -441,8 +463,7 @@ async def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) @@ -469,12 +490,12 @@ async def update_tags( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: ~azure.mgmt.applicationinsights.models.TagsResource + :type component_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ @@ -501,7 +522,7 @@ async def update_tags( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ @@ -522,9 +543,10 @@ async def update_tags( :type resource_name: str :param component_tags: Updated tag information to set into the component instance. Is either a TagsResource type or a IO[bytes] type. Required. - :type component_tags: ~azure.mgmt.applicationinsights.models.TagsResource or IO[bytes] + :type component_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource or + IO[bytes] :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -538,7 +560,7 @@ async def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) @@ -572,8 +594,7 @@ async def update_tags( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) @@ -599,10 +620,6 @@ async def purge( includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected. - Note: this operation is intended for Classic resources, for workspace-based Application - Insights resource please run purge operation (directly on the - workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , - scoped to specific resource id. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -611,12 +628,12 @@ async def purge( :type resource_name: str :param body: Describes the body of a request to purge data in a single table of an Application Insights component. Required. - :type body: ~azure.mgmt.applicationinsights.models.ComponentPurgeBody + :type body: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBody :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -637,10 +654,6 @@ async def purge( includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected. - Note: this operation is intended for Classic resources, for workspace-based Application - Insights resource please run purge operation (directly on the - workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , - scoped to specific resource id. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -654,7 +667,7 @@ async def purge( Default value is "application/json". :paramtype content_type: str :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -673,10 +686,6 @@ async def purge( includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected. - Note: this operation is intended for Classic resources, for workspace-based Application - Insights resource please run purge operation (directly on the - workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , - scoped to specific resource id. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -685,9 +694,9 @@ async def purge( :type resource_name: str :param body: Describes the body of a request to purge data in a single table of an Application Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.applicationinsights.models.ComponentPurgeBody or IO[bytes] + :type body: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBody or IO[bytes] :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -701,7 +710,7 @@ async def purge( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) @@ -735,8 +744,7 @@ async def purge( if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) @@ -760,7 +768,7 @@ async def get_purge_status( is returned. Required. :type purge_id: str :return: ComponentPurgeStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeStatusResponse + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeStatusResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -774,7 +782,7 @@ async def get_purge_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) _request = build_get_purge_status_request( @@ -797,8 +805,7 @@ async def get_purge_status( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_export_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_export_configurations_operations.py similarity index 91% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_export_configurations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_export_configurations_operations.py index 4111356232e4..63a166bec93f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_export_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_export_configurations_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -36,7 +36,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ExportConfigurationsOperations: @@ -45,7 +46,7 @@ class ExportConfigurationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`export_configurations` attribute. """ @@ -73,7 +74,7 @@ async def list( :type resource_name: str :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) :rtype: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -87,7 +88,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) _request = build_list_request( @@ -140,13 +141,13 @@ async def create( :param export_properties: Properties that need to be specified to create a Continuous Export configuration of a Application Insights component. Required. :type export_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) :rtype: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -175,7 +176,7 @@ async def create( :paramtype content_type: str :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) :rtype: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -198,10 +199,11 @@ async def create( configuration of a Application Insights component. Is either a ApplicationInsightsComponentExportRequest type or a IO[bytes] type. Required. :type export_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest or + IO[bytes] :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) :rtype: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -215,7 +217,7 @@ async def create( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) @@ -275,7 +277,8 @@ async def delete( Insights component. Required. :type export_id: str :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -289,7 +292,7 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) _request = build_delete_request( @@ -338,7 +341,8 @@ async def get( Insights component. Required. :type export_id: str :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -352,7 +356,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) _request = build_get_request( @@ -410,12 +414,13 @@ async def update( :param export_properties: Properties that need to be specified to update the Continuous Export configuration. Required. :type export_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -447,7 +452,8 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -474,9 +480,11 @@ async def update( configuration. Is either a ApplicationInsightsComponentExportRequest type or a IO[bytes] type. Required. :type export_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest or + IO[bytes] :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -490,7 +498,7 @@ async def update( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_favorites_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_favorites_operations.py similarity index 92% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_favorites_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_favorites_operations.py index ddff36d0bb7f..fbca9cd3357e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_favorites_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_favorites_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -36,7 +36,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class FavoritesOperations: @@ -45,7 +46,7 @@ class FavoritesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`favorites` attribute. """ @@ -80,11 +81,11 @@ async def list( :type resource_name: str :param favorite_type: The type of favorite. Value can be either shared or user. Known values are: "shared" and "user". Default value is None. - :type favorite_type: str or ~azure.mgmt.applicationinsights.models.FavoriteType + :type favorite_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteType :param source_type: Source type of favorite to return. When left out, the source type defaults to 'other' (not present in this enum). Known values are: "retention", "notebook", "sessions", "events", "userflows", "funnel", "impact", and "segmentation". Default value is None. - :type source_type: str or ~azure.mgmt.applicationinsights.models.FavoriteSourceType + :type source_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteSourceType :param can_fetch_content: Flag indicating whether or not to return the full content for each applicable favorite. If false, only return summary content for favorites. Default value is None. @@ -92,7 +93,8 @@ async def list( :param tags: Tags that must be present on each favorite returned. Default value is None. :type tags: list[str] :return: list of ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite] + :rtype: + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -106,7 +108,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.ApplicationInsightsComponentFavorite]] = kwargs.pop("cls", None) _request = build_list_request( @@ -156,7 +158,7 @@ async def get( component. Required. :type favorite_id: str :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -170,7 +172,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) _request = build_get_request( @@ -226,12 +228,12 @@ async def add( :param favorite_properties: Properties that need to be specified to create a new favorite and add it to an Application Insights component. Required. :type favorite_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ @@ -263,7 +265,7 @@ async def add( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ @@ -290,9 +292,10 @@ async def add( add it to an Application Insights component. Is either a ApplicationInsightsComponentFavorite type or a IO[bytes] type. Required. :type favorite_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite or + IO[bytes] :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -306,7 +309,7 @@ async def add( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) @@ -374,12 +377,12 @@ async def update( :param favorite_properties: Properties that need to be specified to update the existing favorite. Required. :type favorite_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ @@ -411,7 +414,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ @@ -437,9 +440,10 @@ async def update( :param favorite_properties: Properties that need to be specified to update the existing favorite. Is either a ApplicationInsightsComponentFavorite type or a IO[bytes] type. Required. :type favorite_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite or + IO[bytes] :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -453,7 +457,7 @@ async def update( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) @@ -524,7 +528,7 @@ async def delete(self, resource_group_name: str, resource_name: str, favorite_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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_my_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_my_workbooks_operations.py new file mode 100644 index 000000000000..f19c5b68ab18 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_my_workbooks_operations.py @@ -0,0 +1,653 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._my_workbooks_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class MyWorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s + :attr:`my_workbooks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.MyWorkbook"]: + """Get all private workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either MyWorkbook or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MyWorkbooksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return 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.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.MyWorkbook"]: + """Get all private workbooks defined within a specified subscription and category. + + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either MyWorkbook or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MyWorkbooksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return 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.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.MyWorkbook: + """Get a single private workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Delete a private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.MyWorkbook, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.MyWorkbook, IO[bytes]], + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook or + IO[bytes] + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "MyWorkbook") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.MyWorkbook, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.MyWorkbook, IO[bytes]], + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook or + IO[bytes] + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "MyWorkbook") + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_operations.py similarity index 80% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_operations.py index 14cc2d1cf708..36c4f85b1c79 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -30,7 +31,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class Operations: @@ -39,7 +41,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`operations` attribute. """ @@ -60,13 +62,13 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.Operation] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -88,7 +90,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -111,7 +124,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_patch.py similarity index 89% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_patch.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_patch.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_proactive_detection_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_proactive_detection_configurations_operations.py similarity index 92% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_proactive_detection_configurations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_proactive_detection_configurations_operations.py index 09e92f5e5bbd..94adfd07704e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_proactive_detection_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_proactive_detection_configurations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -34,7 +35,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-long @@ -43,7 +45,7 @@ class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-lo **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`proactive_detection_configurations` attribute. """ @@ -72,7 +74,7 @@ async def list( :return: list of ApplicationInsightsComponentProactiveDetectionConfiguration or the result of cls(response) :rtype: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -86,7 +88,7 @@ async def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( "cls", None ) @@ -138,7 +140,7 @@ async def get( :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of cls(response) :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -152,7 +154,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) _request = build_get_request( @@ -210,14 +212,14 @@ async def update( :param proactive_detection_properties: Properties that need to be specified to update the ProactiveDetection configuration. Required. :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of cls(response) :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -251,7 +253,7 @@ async def update( :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of cls(response) :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -280,12 +282,12 @@ async def update( ProactiveDetection configuration. Is either a ApplicationInsightsComponentProactiveDetectionConfiguration type or a IO[bytes] type. Required. :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration or IO[bytes] :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of cls(response) :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -299,7 +301,7 @@ async def update( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_web_test_locations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_test_locations_operations.py similarity index 83% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_web_test_locations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_test_locations_operations.py index 1aa4451028c8..964e82d4a1b3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_web_test_locations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_test_locations_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +32,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class WebTestLocationsOperations: @@ -40,7 +42,7 @@ class WebTestLocationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`web_test_locations` attribute. """ @@ -69,13 +71,13 @@ def list( :return: An iterator like instance of either ApplicationInsightsComponentWebTestLocation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentWebTestLocation] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentWebTestLocation] :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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsWebTestLocationsListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -100,7 +102,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_tests_operations.py new file mode 100644 index 000000000000..3173e0322573 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_tests_operations.py @@ -0,0 +1,676 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._web_tests_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_component_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class WebTestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s + :attr:`web_tests` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined within a specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: + """Get a specific Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: _models.WebTest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: Union[_models.WebTest, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. + Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest or + IO[bytes] + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(web_test_definition, (IOBase, bytes)): + _content = web_test_definition + else: + _json = self._serialize.body(web_test_definition, "WebTest") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Required. + :type web_test_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: Union[_models.TagsResource, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Is either a + TagsResource type or a IO[bytes] type. Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource or + IO[bytes] + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(web_test_tags, (IOBase, bytes)): + _content = web_test_tags + else: + _json = self._serialize.body(web_test_tags, "TagsResource") + + _request = build_update_tags_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> None: + """Deletes an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: + """Get all Application Insights web test alerts definitions within a subscription. + + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_component( + self, component_name: str, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined for the specified component. + + :param component_name: The name of the Application Insights component resource. Required. + :type component_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_component_request( + component_name=component_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_work_item_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_work_item_configurations_operations.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_work_item_configurations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_work_item_configurations_operations.py index 711951a2ab7b..4e922245cd4d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_work_item_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_work_item_configurations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,7 +41,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class WorkItemConfigurationsOperations: @@ -48,7 +51,7 @@ class WorkItemConfigurationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s :attr:`work_item_configurations` attribute. """ @@ -77,13 +80,13 @@ def list( :return: An iterator like instance of either WorkItemConfiguration or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.WorkItemConfiguration] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration] :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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkItemConfigurationsListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -108,7 +111,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -131,7 +145,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkItemConfigurationError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkItemConfigurationError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -158,12 +175,12 @@ async def create( :param work_item_configuration_properties: Properties that need to be specified to create a work item configuration of a Application Insights component. Required. :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -191,7 +208,7 @@ async def create( Default value is "application/json". :paramtype content_type: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -214,9 +231,9 @@ async def create( work item configuration of a Application Insights component. Is either a WorkItemCreateConfiguration type or a IO[bytes] type. Required. :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration or IO[bytes] :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -230,7 +247,7 @@ async def create( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) @@ -285,7 +302,7 @@ async def get_default( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -299,7 +316,7 @@ async def get_default( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) _request = build_get_default_request( @@ -359,7 +376,7 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -402,7 +419,7 @@ async def get_item( name of connector as defined in connector configuration. Required. :type work_item_config_id: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -416,7 +433,7 @@ async def get_item( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) _request = build_get_item_request( @@ -472,12 +489,12 @@ async def update_item( :param work_item_configuration_properties: Properties that need to be specified to update a work item configuration for this Application Insights component. Required. :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -509,7 +526,7 @@ async def update_item( Default value is "application/json". :paramtype content_type: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -536,9 +553,9 @@ async def update_item( work item configuration for this Application Insights component. Is either a WorkItemCreateConfiguration type or a IO[bytes] type. Required. :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration or IO[bytes] :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -552,7 +569,7 @@ async def update_item( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_workbooks_operations.py new file mode 100644 index 000000000000..1288f332511b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_workbooks_operations.py @@ -0,0 +1,555 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._workbooks_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_update_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class WorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s + :attr:`workbooks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either Workbook or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbooksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Workbook: + """Get a single workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Delete a workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.Workbook, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.Workbook, IO[bytes]], + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. Is + either a Workbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook or + IO[bytes] + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "Workbook") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.Workbook, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.Workbook, IO[bytes]], + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. Is + either a Workbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook or + IO[bytes] + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "Workbook") + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/__init__.py similarity index 63% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/__init__.py index 823347bc3cbb..e51fb7fa8416 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/__init__.py @@ -38,51 +38,28 @@ ApplicationInsightsComponentQuotaStatus, ApplicationInsightsComponentWebTestLocation, ApplicationInsightsWebTestLocationsListResult, - ComponentLinkedStorageAccounts, - ComponentLinkedStorageAccountsPatch, ComponentPurgeBody, ComponentPurgeBodyFilters, ComponentPurgeResponse, ComponentPurgeStatusResponse, ComponentsResource, - DeletedWorkbook, - DeletedWorkbookError, - DeletedWorkbookErrorDefinition, - DeletedWorkbookInnerErrorTrace, - DeletedWorkbookResource, - DeletedWorkbooksListResult, ErrorFieldContract, ErrorResponse, - ErrorResponseComponents, - ErrorResponseComponentsError, - ErrorResponseLinkedStorage, - ErrorResponseLinkedStorageError, - HeaderField, InnerError, - LiveTokenResponse, - ManagedServiceIdentity, + LinkProperties, + MyWorkbook, + MyWorkbookError, + MyWorkbookResource, + MyWorkbooksListResult, Operation, OperationDisplay, - OperationInfo, OperationListResult, - OperationLive, - OperationsListResult, PrivateLinkScopedResource, - ProxyResource, - Resource, - ResourceAutoGenerated, - SystemData, TagsResource, - TrackedResource, - TrackedResourceAutoGenerated, - UserAssignedIdentity, WebTest, WebTestGeolocation, WebTestListResult, WebTestPropertiesConfiguration, - WebTestPropertiesRequest, - WebTestPropertiesValidationRules, - WebTestPropertiesValidationRulesContentValidation, WebtestsResource, WorkItemConfiguration, WorkItemConfigurationError, @@ -90,27 +67,13 @@ WorkItemCreateConfiguration, Workbook, WorkbookError, - WorkbookErrorDefinition, - WorkbookInnerErrorTrace, WorkbookResource, - WorkbookResourceIdentity, - WorkbookTemplate, - WorkbookTemplateError, - WorkbookTemplateErrorBody, - WorkbookTemplateErrorFieldContract, - WorkbookTemplateGallery, - WorkbookTemplateLocalizedGallery, - WorkbookTemplateResource, - WorkbookTemplateUpdateParameters, - WorkbookTemplatesListResult, - WorkbookUpdateParameters, WorkbooksListResult, ) from ._application_insights_management_client_enums import ( # type: ignore ApplicationType, CategoryType, - CreatedByType, FavoriteSourceType, FavoriteType, FlowType, @@ -119,14 +82,10 @@ ItemScopePath, ItemType, ItemTypeParameter, - ManagedServiceIdentityType, - PublicNetworkAccessType, PurgeState, RequestSource, - StorageType, + SharedTypeKind, WebTestKind, - WorkbookSharedTypeKind, - WorkbookUpdateSharedTypeKind, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -157,51 +116,28 @@ "ApplicationInsightsComponentQuotaStatus", "ApplicationInsightsComponentWebTestLocation", "ApplicationInsightsWebTestLocationsListResult", - "ComponentLinkedStorageAccounts", - "ComponentLinkedStorageAccountsPatch", "ComponentPurgeBody", "ComponentPurgeBodyFilters", "ComponentPurgeResponse", "ComponentPurgeStatusResponse", "ComponentsResource", - "DeletedWorkbook", - "DeletedWorkbookError", - "DeletedWorkbookErrorDefinition", - "DeletedWorkbookInnerErrorTrace", - "DeletedWorkbookResource", - "DeletedWorkbooksListResult", "ErrorFieldContract", "ErrorResponse", - "ErrorResponseComponents", - "ErrorResponseComponentsError", - "ErrorResponseLinkedStorage", - "ErrorResponseLinkedStorageError", - "HeaderField", "InnerError", - "LiveTokenResponse", - "ManagedServiceIdentity", + "LinkProperties", + "MyWorkbook", + "MyWorkbookError", + "MyWorkbookResource", + "MyWorkbooksListResult", "Operation", "OperationDisplay", - "OperationInfo", "OperationListResult", - "OperationLive", - "OperationsListResult", "PrivateLinkScopedResource", - "ProxyResource", - "Resource", - "ResourceAutoGenerated", - "SystemData", "TagsResource", - "TrackedResource", - "TrackedResourceAutoGenerated", - "UserAssignedIdentity", "WebTest", "WebTestGeolocation", "WebTestListResult", "WebTestPropertiesConfiguration", - "WebTestPropertiesRequest", - "WebTestPropertiesValidationRules", - "WebTestPropertiesValidationRulesContentValidation", "WebtestsResource", "WorkItemConfiguration", "WorkItemConfigurationError", @@ -209,24 +145,10 @@ "WorkItemCreateConfiguration", "Workbook", "WorkbookError", - "WorkbookErrorDefinition", - "WorkbookInnerErrorTrace", "WorkbookResource", - "WorkbookResourceIdentity", - "WorkbookTemplate", - "WorkbookTemplateError", - "WorkbookTemplateErrorBody", - "WorkbookTemplateErrorFieldContract", - "WorkbookTemplateGallery", - "WorkbookTemplateLocalizedGallery", - "WorkbookTemplateResource", - "WorkbookTemplateUpdateParameters", - "WorkbookTemplatesListResult", - "WorkbookUpdateParameters", "WorkbooksListResult", "ApplicationType", "CategoryType", - "CreatedByType", "FavoriteSourceType", "FavoriteType", "FlowType", @@ -235,14 +157,10 @@ "ItemScopePath", "ItemType", "ItemTypeParameter", - "ManagedServiceIdentityType", - "PublicNetworkAccessType", "PurgeState", "RequestSource", - "StorageType", + "SharedTypeKind", "WebTestKind", - "WorkbookSharedTypeKind", - "WorkbookUpdateSharedTypeKind", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_application_insights_management_client_enums.py similarity index 69% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_application_insights_management_client_enums.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_application_insights_management_client_enums.py index a38616606d74..2a149254cbfb 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_application_insights_management_client_enums.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_application_insights_management_client_enums.py @@ -26,15 +26,6 @@ class CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): RETENTION = "retention" -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - class FavoriteSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """FavoriteSourceType.""" @@ -109,28 +100,6 @@ class ItemTypeParameter(str, Enum, metaclass=CaseInsensitiveEnumMeta): RECENT = "recent" -class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (where both SystemAssigned and UserAssigned types are - allowed). - """ - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The network access type for operating on the Application Insights Component. By default it is - Enabled. - """ - - ENABLED = "Enabled" - """Enables connectivity to Application Insights through public DNS.""" - DISABLED = "Disabled" - """Disables public connectivity to Application Insights through public DNS.""" - - class PurgeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status of the operation represented by the requested Id.""" @@ -146,27 +115,15 @@ class RequestSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): REST = "rest" -class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """StorageType.""" +class SharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of workbook. Choices are user and shared.""" - SERVICE_PROFILER = "ServiceProfiler" + USER = "user" + SHARED = "shared" class WebTestKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of WebTest that this web test watches. Choices are ping, multistep and standard.""" + """The kind of web test that this web test watches. Choices are ping and multistep.""" PING = "ping" MULTISTEP = "multistep" - STANDARD = "standard" - - -class WorkbookSharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of workbook. Only valid value is shared.""" - - SHARED = "shared" - - -class WorkbookUpdateSharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of workbook. Only valid value is shared.""" - - SHARED = "shared" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_models_py3.py similarity index 55% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_models_py3.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_models_py3.py index edb76c1936d2..f89094e755da 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_models_py3.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_models_py3.py @@ -7,15 +7,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from collections.abc import MutableMapping import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Optional, TYPE_CHECKING, Union from .._utils import serialization as _serialization if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] class Annotation(_serialization.Model): @@ -86,7 +84,7 @@ class AnnotationError(_serialization.Model): :ivar message: Error message. :vartype message: str :ivar innererror: Inner error. - :vartype innererror: ~azure.mgmt.applicationinsights.models.InnerError + :vartype innererror: ~azure.mgmt.applicationinsights.v2015_05_01.models.InnerError """ _attribute_map = { @@ -109,7 +107,7 @@ def __init__( :keyword message: Error message. :paramtype message: str :keyword innererror: Inner error. - :paramtype innererror: ~azure.mgmt.applicationinsights.models.InnerError + :paramtype innererror: ~azure.mgmt.applicationinsights.v2015_05_01.models.InnerError """ super().__init__(**kwargs) self.code = code @@ -123,7 +121,7 @@ class AnnotationsListResult(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: An array of annotations. - :vartype value: list[~azure.mgmt.applicationinsights.models.Annotation] + :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] """ _validation = { @@ -137,7 +135,7 @@ class AnnotationsListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value: Optional[List["_models.Annotation"]] = None + self.value: Optional[list["_models.Annotation"]] = None class APIKeyRequest(_serialization.Model): @@ -161,8 +159,8 @@ def __init__( self, *, name: Optional[str] = None, - linked_read_properties: Optional[List[str]] = None, - linked_write_properties: Optional[List[str]] = None, + linked_read_properties: Optional[list[str]] = None, + linked_write_properties: Optional[list[str]] = None, **kwargs: Any ) -> None: """ @@ -213,7 +211,7 @@ class ComponentsResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword location: Resource location. Required. :paramtype location: str @@ -249,25 +247,23 @@ class ApplicationInsightsComponent(ComponentsResource): value is a freeform string, values should typically be one of the following: web, ios, other, store, java, phone. Required. :vartype kind: str - :ivar etag: Resource etag. - :vartype etag: str :ivar application_id: The unique ID of your application. This field mirrors the 'Name' field and cannot be changed. :vartype application_id: str :ivar app_id: Application Insights Unique ID for your Application. :vartype app_id: str - :ivar name_properties_name: Application name. - :vartype name_properties_name: str :ivar application_type: Type of application being monitored. Known values are: "web" and "other". - :vartype application_type: str or ~azure.mgmt.applicationinsights.models.ApplicationType + :vartype application_type: str or + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationType :ivar flow_type: Used by the Application Insights system to determine what kind of flow this component was created by. This is to be set to 'Bluefield' when creating/updating a component via the REST API. "Bluefield" - :vartype flow_type: str or ~azure.mgmt.applicationinsights.models.FlowType + :vartype flow_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FlowType :ivar request_source: Describes what tool created this Application Insights component. Customers using this API should set this to the default 'rest'. "rest" - :vartype request_source: str or ~azure.mgmt.applicationinsights.models.RequestSource + :vartype request_source: str or + ~azure.mgmt.applicationinsights.v2015_05_01.models.RequestSource :ivar instrumentation_key: Application Insights Instrumentation key. A read-only value that applications can use to identify the destination for all telemetry sent to Azure Application Insights. This value will be supplied upon construction of each new Application Insights @@ -298,31 +294,13 @@ class ApplicationInsightsComponent(ComponentsResource): :vartype disable_ip_masking: bool :ivar immediate_purge_data_on30_days: Purge data immediately after 30 days. :vartype immediate_purge_data_on30_days: bool - :ivar workspace_resource_id: Resource Id of the log analytics workspace which the data will be - ingested to. This property is required to create an application with this API version. - Applications from older versions will not have this property. - :vartype workspace_resource_id: str - :ivar la_migration_date: The date which the component got migrated to LA, in ISO 8601 format. - :vartype la_migration_date: ~datetime.datetime :ivar private_link_scoped_resources: List of linked private link scope resources. :vartype private_link_scoped_resources: - list[~azure.mgmt.applicationinsights.models.PrivateLinkScopedResource] - :ivar public_network_access_for_ingestion: The network access type for accessing Application - Insights ingestion. Known values are: "Enabled" and "Disabled". - :vartype public_network_access_for_ingestion: str or - ~azure.mgmt.applicationinsights.models.PublicNetworkAccessType - :ivar public_network_access_for_query: The network access type for accessing Application - Insights query. Known values are: "Enabled" and "Disabled". - :vartype public_network_access_for_query: str or - ~azure.mgmt.applicationinsights.models.PublicNetworkAccessType + list[~azure.mgmt.applicationinsights.v2015_05_01.models.PrivateLinkScopedResource] :ivar ingestion_mode: Indicates the flow of the ingestion. Known values are: "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". - :vartype ingestion_mode: str or ~azure.mgmt.applicationinsights.models.IngestionMode - :ivar disable_local_auth: Disable Non-AAD based Auth. - :vartype disable_local_auth: bool - :ivar force_customer_storage_for_profiler: Force users to create their own storage account for - profiler and debugger. - :vartype force_customer_storage_for_profiler: bool + :vartype ingestion_mode: str or + ~azure.mgmt.applicationinsights.v2015_05_01.models.IngestionMode """ _validation = { @@ -333,14 +311,12 @@ class ApplicationInsightsComponent(ComponentsResource): "kind": {"required": True}, "application_id": {"readonly": True}, "app_id": {"readonly": True}, - "name_properties_name": {"readonly": True}, "instrumentation_key": {"readonly": True}, "creation_date": {"readonly": True}, "tenant_id": {"readonly": True}, "hockey_app_token": {"readonly": True}, "provisioning_state": {"readonly": True}, "connection_string": {"readonly": True}, - "la_migration_date": {"readonly": True}, "private_link_scoped_resources": {"readonly": True}, } @@ -351,10 +327,8 @@ class ApplicationInsightsComponent(ComponentsResource): "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, "application_id": {"key": "properties.ApplicationId", "type": "str"}, "app_id": {"key": "properties.AppId", "type": "str"}, - "name_properties_name": {"key": "properties.Name", "type": "str"}, "application_type": {"key": "properties.Application_Type", "type": "str"}, "flow_type": {"key": "properties.Flow_Type", "type": "str"}, "request_source": {"key": "properties.Request_Source", "type": "str"}, @@ -369,40 +343,28 @@ class ApplicationInsightsComponent(ComponentsResource): "retention_in_days": {"key": "properties.RetentionInDays", "type": "int"}, "disable_ip_masking": {"key": "properties.DisableIpMasking", "type": "bool"}, "immediate_purge_data_on30_days": {"key": "properties.ImmediatePurgeDataOn30Days", "type": "bool"}, - "workspace_resource_id": {"key": "properties.WorkspaceResourceId", "type": "str"}, - "la_migration_date": {"key": "properties.LaMigrationDate", "type": "iso-8601"}, "private_link_scoped_resources": { "key": "properties.PrivateLinkScopedResources", "type": "[PrivateLinkScopedResource]", }, - "public_network_access_for_ingestion": {"key": "properties.publicNetworkAccessForIngestion", "type": "str"}, - "public_network_access_for_query": {"key": "properties.publicNetworkAccessForQuery", "type": "str"}, "ingestion_mode": {"key": "properties.IngestionMode", "type": "str"}, - "disable_local_auth": {"key": "properties.DisableLocalAuth", "type": "bool"}, - "force_customer_storage_for_profiler": {"key": "properties.ForceCustomerStorageForProfiler", "type": "bool"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, location: str, kind: str, - tags: Optional[Dict[str, str]] = None, - etag: Optional[str] = None, + tags: Optional[dict[str, str]] = None, application_type: Union[str, "_models.ApplicationType"] = "web", flow_type: Union[str, "_models.FlowType"] = "Bluefield", request_source: Union[str, "_models.RequestSource"] = "rest", hockey_app_id: Optional[str] = None, sampling_percentage: Optional[float] = None, - retention_in_days: Optional[int] = None, + retention_in_days: int = 90, disable_ip_masking: Optional[bool] = None, immediate_purge_data_on30_days: Optional[bool] = None, - workspace_resource_id: Optional[str] = None, - public_network_access_for_ingestion: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", - public_network_access_for_query: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", - ingestion_mode: Union[str, "_models.IngestionMode"] = "LogAnalytics", - disable_local_auth: Optional[bool] = None, - force_customer_storage_for_profiler: Optional[bool] = None, + ingestion_mode: Union[str, "_models.IngestionMode"] = "ApplicationInsights", **kwargs: Any ) -> None: """ @@ -414,18 +376,18 @@ def __init__( # pylint: disable=too-many-locals This value is a freeform string, values should typically be one of the following: web, ios, other, store, java, phone. Required. :paramtype kind: str - :keyword etag: Resource etag. - :paramtype etag: str :keyword application_type: Type of application being monitored. Known values are: "web" and "other". - :paramtype application_type: str or ~azure.mgmt.applicationinsights.models.ApplicationType + :paramtype application_type: str or + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationType :keyword flow_type: Used by the Application Insights system to determine what kind of flow this component was created by. This is to be set to 'Bluefield' when creating/updating a component via the REST API. "Bluefield" - :paramtype flow_type: str or ~azure.mgmt.applicationinsights.models.FlowType + :paramtype flow_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FlowType :keyword request_source: Describes what tool created this Application Insights component. Customers using this API should set this to the default 'rest'. "rest" - :paramtype request_source: str or ~azure.mgmt.applicationinsights.models.RequestSource + :paramtype request_source: str or + ~azure.mgmt.applicationinsights.v2015_05_01.models.RequestSource :keyword hockey_app_id: The unique application ID created when a new application is added to HockeyApp, used for communications with HockeyApp. :paramtype hockey_app_id: str @@ -438,33 +400,15 @@ def __init__( # pylint: disable=too-many-locals :paramtype disable_ip_masking: bool :keyword immediate_purge_data_on30_days: Purge data immediately after 30 days. :paramtype immediate_purge_data_on30_days: bool - :keyword workspace_resource_id: Resource Id of the log analytics workspace which the data will - be ingested to. This property is required to create an application with this API version. - Applications from older versions will not have this property. - :paramtype workspace_resource_id: str - :keyword public_network_access_for_ingestion: The network access type for accessing Application - Insights ingestion. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access_for_ingestion: str or - ~azure.mgmt.applicationinsights.models.PublicNetworkAccessType - :keyword public_network_access_for_query: The network access type for accessing Application - Insights query. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access_for_query: str or - ~azure.mgmt.applicationinsights.models.PublicNetworkAccessType :keyword ingestion_mode: Indicates the flow of the ingestion. Known values are: "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". - :paramtype ingestion_mode: str or ~azure.mgmt.applicationinsights.models.IngestionMode - :keyword disable_local_auth: Disable Non-AAD based Auth. - :paramtype disable_local_auth: bool - :keyword force_customer_storage_for_profiler: Force users to create their own storage account - for profiler and debugger. - :paramtype force_customer_storage_for_profiler: bool + :paramtype ingestion_mode: str or + ~azure.mgmt.applicationinsights.v2015_05_01.models.IngestionMode """ super().__init__(location=location, tags=tags, **kwargs) self.kind = kind - self.etag = etag self.application_id: Optional[str] = None self.app_id: Optional[str] = None - self.name_properties_name: Optional[str] = None self.application_type = application_type self.flow_type = flow_type self.request_source = request_source @@ -479,14 +423,8 @@ def __init__( # pylint: disable=too-many-locals self.retention_in_days = retention_in_days self.disable_ip_masking = disable_ip_masking self.immediate_purge_data_on30_days = immediate_purge_data_on30_days - self.workspace_resource_id = workspace_resource_id - self.la_migration_date: Optional[datetime.datetime] = None - self.private_link_scoped_resources: Optional[List["_models.PrivateLinkScopedResource"]] = None - self.public_network_access_for_ingestion = public_network_access_for_ingestion - self.public_network_access_for_query = public_network_access_for_query + self.private_link_scoped_resources: Optional[list["_models.PrivateLinkScopedResource"]] = None self.ingestion_mode = ingestion_mode - self.disable_local_auth = disable_local_auth - self.force_customer_storage_for_profiler = force_customer_storage_for_profiler class ApplicationInsightsComponentAnalyticsItem(_serialization.Model): # pylint: disable=name-too-long @@ -507,10 +445,10 @@ class ApplicationInsightsComponentAnalyticsItem(_serialization.Model): # pylint :ivar scope: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "shared" and "user". - :vartype scope: str or ~azure.mgmt.applicationinsights.models.ItemScope + :vartype scope: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScope :ivar type: Enum indicating the type of the Analytics item. Known values are: "none", "query", "recent", and "function". - :vartype type: str or ~azure.mgmt.applicationinsights.models.ItemType + :vartype type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemType :ivar time_created: Date and time in UTC when this item was created. :vartype time_created: str :ivar time_modified: Date and time in UTC of the last modification that was made to this item. @@ -518,7 +456,7 @@ class ApplicationInsightsComponentAnalyticsItem(_serialization.Model): # pylint :ivar properties: A set of properties that can be defined in the context of a specific item type. Each type may have its own properties. :vartype properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItemProperties + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItemProperties """ _validation = { @@ -560,14 +498,14 @@ def __init__( :keyword scope: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "shared" and "user". - :paramtype scope: str or ~azure.mgmt.applicationinsights.models.ItemScope + :paramtype scope: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScope :keyword type: Enum indicating the type of the Analytics item. Known values are: "none", "query", "recent", and "function". - :paramtype type: str or ~azure.mgmt.applicationinsights.models.ItemType + :paramtype type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemType :keyword properties: A set of properties that can be defined in the context of a specific item type. Each type may have its own properties. :paramtype properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItemProperties + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItemProperties """ super().__init__(**kwargs) self.id = id @@ -641,8 +579,8 @@ def __init__( *, created_date: Optional[str] = None, name: Optional[str] = None, - linked_read_properties: Optional[List[str]] = None, - linked_write_properties: Optional[List[str]] = None, + linked_read_properties: Optional[list[str]] = None, + linked_write_properties: Optional[list[str]] = None, **kwargs: Any ) -> None: """ @@ -670,7 +608,8 @@ class ApplicationInsightsComponentAPIKeyListResult(_serialization.Model): # pyl All required parameters must be populated in order to send to server. :ivar value: List of API Key definitions. Required. - :vartype value: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey] + :vartype value: + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey] """ _validation = { @@ -681,11 +620,11 @@ class ApplicationInsightsComponentAPIKeyListResult(_serialization.Model): # pyl "value": {"key": "value", "type": "[ApplicationInsightsComponentAPIKey]"}, } - def __init__(self, *, value: List["_models.ApplicationInsightsComponentAPIKey"], **kwargs: Any) -> None: + def __init__(self, *, value: list["_models.ApplicationInsightsComponentAPIKey"], **kwargs: Any) -> None: """ :keyword value: List of API Key definitions. Required. :paramtype value: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey] """ super().__init__(**kwargs) self.value = value @@ -698,7 +637,7 @@ class ApplicationInsightsComponentAvailableFeatures(_serialization.Model): # py :ivar result: A list of Application Insights component feature. :vartype result: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeature] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFeature] """ _validation = { @@ -712,7 +651,7 @@ class ApplicationInsightsComponentAvailableFeatures(_serialization.Model): # py def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.result: Optional[List["_models.ApplicationInsightsComponentFeature"]] = None + self.result: Optional[list["_models.ApplicationInsightsComponentFeature"]] = None class ApplicationInsightsComponentBillingFeatures(_serialization.Model): # pylint: disable=name-too-long @@ -720,7 +659,7 @@ class ApplicationInsightsComponentBillingFeatures(_serialization.Model): # pyli :ivar data_volume_cap: An Application Insights component daily data volume cap. :vartype data_volume_cap: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentDataVolumeCap + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentDataVolumeCap :ivar current_billing_features: Current enabled pricing plan. When the component is in the Enterprise plan, this will list both 'Basic' and 'Application Insights Enterprise'. :vartype current_billing_features: list[str] @@ -735,13 +674,13 @@ def __init__( self, *, data_volume_cap: Optional["_models.ApplicationInsightsComponentDataVolumeCap"] = None, - current_billing_features: Optional[List[str]] = None, + current_billing_features: Optional[list[str]] = None, **kwargs: Any ) -> None: """ :keyword data_volume_cap: An Application Insights component daily data volume cap. :paramtype data_volume_cap: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentDataVolumeCap + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentDataVolumeCap :keyword current_billing_features: Current enabled pricing plan. When the component is in the Enterprise plan, this will list both 'Basic' and 'Application Insights Enterprise'. :paramtype current_billing_features: list[str] @@ -1050,7 +989,7 @@ class ApplicationInsightsComponentFavorite(_serialization.Model): :ivar favorite_type: Enum indicating if this favorite definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "shared" and "user". - :vartype favorite_type: str or ~azure.mgmt.applicationinsights.models.FavoriteType + :vartype favorite_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteType :ivar source_type: The source of the favorite definition. :vartype source_type: str :ivar time_modified: Date and time in UTC of the last modification that was made to this @@ -1095,7 +1034,7 @@ def __init__( version: Optional[str] = None, favorite_type: Optional[Union[str, "_models.FavoriteType"]] = None, source_type: Optional[str] = None, - tags: Optional[List[str]] = None, + tags: Optional[list[str]] = None, category: Optional[str] = None, is_generated_from_template: Optional[bool] = None, **kwargs: Any @@ -1113,7 +1052,8 @@ def __init__( :keyword favorite_type: Enum indicating if this favorite definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "shared" and "user". - :paramtype favorite_type: str or ~azure.mgmt.applicationinsights.models.FavoriteType + :paramtype favorite_type: str or + ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteType :keyword source_type: The source of the favorite definition. :paramtype source_type: str :keyword tags: A list of 0 or more tags that are associated with this favorite definition. @@ -1155,7 +1095,7 @@ class ApplicationInsightsComponentFeature(_serialization.Model): :vartype is_hidden: bool :ivar capabilities: A list of Application Insights component feature capability. :vartype capabilities: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeatureCapability] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFeatureCapability] :ivar title: Display name of the feature. :vartype title: str :ivar is_main_feature: Whether can apply addon feature on to it. @@ -1196,7 +1136,7 @@ def __init__(self, **kwargs: Any) -> None: self.meter_rate_frequency: Optional[str] = None self.resouce_id: Optional[str] = None self.is_hidden: Optional[bool] = None - self.capabilities: Optional[List["_models.ApplicationInsightsComponentFeatureCapability"]] = None + self.capabilities: Optional[list["_models.ApplicationInsightsComponentFeatureCapability"]] = None self.title: Optional[str] = None self.is_main_feature: Optional[bool] = None self.supported_addon_features: Optional[str] = None @@ -1354,7 +1294,8 @@ class ApplicationInsightsComponentListResult(_serialization.Model): All required parameters must be populated in order to send to server. :ivar value: List of Application Insights component definitions. Required. - :vartype value: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent] + :vartype value: + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] :ivar next_link: The URI to get the next set of Application Insights component definitions if too many components where returned in the result set. :vartype next_link: str @@ -1370,11 +1311,12 @@ class ApplicationInsightsComponentListResult(_serialization.Model): } def __init__( - self, *, value: List["_models.ApplicationInsightsComponent"], next_link: Optional[str] = None, **kwargs: Any + self, *, value: list["_models.ApplicationInsightsComponent"], next_link: Optional[str] = None, **kwargs: Any ) -> None: """ :keyword value: List of Application Insights component definitions. Required. - :paramtype value: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent] + :paramtype value: + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] :keyword next_link: The URI to get the next set of Application Insights component definitions if too many components where returned in the result set. :paramtype next_link: str @@ -1403,17 +1345,17 @@ class ApplicationInsightsComponentProactiveDetectionConfiguration( :ivar rule_definitions: Static definitions of the ProactiveDetection configuration rule (same values for all components). :vartype rule_definitions: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "enabled": {"key": "enabled", "type": "bool"}, - "send_emails_to_subscription_owners": {"key": "sendEmailsToSubscriptionOwners", "type": "bool"}, - "custom_emails": {"key": "customEmails", "type": "[str]"}, - "last_updated_time": {"key": "lastUpdatedTime", "type": "str"}, + "name": {"key": "Name", "type": "str"}, + "enabled": {"key": "Enabled", "type": "bool"}, + "send_emails_to_subscription_owners": {"key": "SendEmailsToSubscriptionOwners", "type": "bool"}, + "custom_emails": {"key": "CustomEmails", "type": "[str]"}, + "last_updated_time": {"key": "LastUpdatedTime", "type": "str"}, "rule_definitions": { - "key": "ruleDefinitions", + "key": "RuleDefinitions", "type": "ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions", }, } @@ -1424,7 +1366,7 @@ def __init__( name: Optional[str] = None, enabled: Optional[bool] = None, send_emails_to_subscription_owners: Optional[bool] = None, - custom_emails: Optional[List[str]] = None, + custom_emails: Optional[list[str]] = None, last_updated_time: Optional[str] = None, rule_definitions: Optional[ "_models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions" @@ -1446,7 +1388,7 @@ def __init__( :keyword rule_definitions: Static definitions of the ProactiveDetection configuration rule (same values for all components). :paramtype rule_definitions: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions """ super().__init__(**kwargs) self.name = name @@ -1606,7 +1548,7 @@ class ApplicationInsightsWebTestLocationsListResult(_serialization.Model): # py :ivar value: List of web test locations. Required. :vartype value: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentWebTestLocation] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentWebTestLocation] """ _validation = { @@ -1617,127 +1559,16 @@ class ApplicationInsightsWebTestLocationsListResult(_serialization.Model): # py "value": {"key": "value", "type": "[ApplicationInsightsComponentWebTestLocation]"}, } - def __init__(self, *, value: List["_models.ApplicationInsightsComponentWebTestLocation"], **kwargs: Any) -> None: + def __init__(self, *, value: list["_models.ApplicationInsightsComponentWebTestLocation"], **kwargs: Any) -> None: """ :keyword value: List of web test locations. Required. :paramtype value: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentWebTestLocation] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentWebTestLocation] """ super().__init__(**kwargs) self.value = value -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: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = 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 - """ - - -class ComponentLinkedStorageAccounts(ProxyResource): - """An Application Insights component linked storage accounts. - - 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 linked_storage_account: Linked storage account resource ID. - :vartype linked_storage_account: 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"}, - "linked_storage_account": {"key": "properties.linkedStorageAccount", "type": "str"}, - } - - def __init__(self, *, linked_storage_account: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword linked_storage_account: Linked storage account resource ID. - :paramtype linked_storage_account: str - """ - super().__init__(**kwargs) - self.linked_storage_account = linked_storage_account - - -class ComponentLinkedStorageAccountsPatch(_serialization.Model): - """An Application Insights component linked storage accounts patch. - - :ivar linked_storage_account: Linked storage account resource ID. - :vartype linked_storage_account: str - """ - - _attribute_map = { - "linked_storage_account": {"key": "properties.linkedStorageAccount", "type": "str"}, - } - - def __init__(self, *, linked_storage_account: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword linked_storage_account: Linked storage account resource ID. - :paramtype linked_storage_account: str - """ - super().__init__(**kwargs) - self.linked_storage_account = linked_storage_account - - class ComponentPurgeBody(_serialization.Model): """Describes the body of a purge request for an App Insights component. @@ -1747,7 +1578,8 @@ class ComponentPurgeBody(_serialization.Model): :vartype table: str :ivar filters: The set of columns and filters (queries) to run over them to purge the resulting data. Required. - :vartype filters: list[~azure.mgmt.applicationinsights.models.ComponentPurgeBodyFilters] + :vartype filters: + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBodyFilters] """ _validation = { @@ -1760,13 +1592,14 @@ class ComponentPurgeBody(_serialization.Model): "filters": {"key": "filters", "type": "[ComponentPurgeBodyFilters]"}, } - def __init__(self, *, table: str, filters: List["_models.ComponentPurgeBodyFilters"], **kwargs: Any) -> None: + def __init__(self, *, table: str, filters: list["_models.ComponentPurgeBodyFilters"], **kwargs: Any) -> None: """ :keyword table: Table from which to purge data. Required. :paramtype table: str :keyword filters: The set of columns and filters (queries) to run over them to purge the resulting data. Required. - :paramtype filters: list[~azure.mgmt.applicationinsights.models.ComponentPurgeBodyFilters] + :paramtype filters: + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBodyFilters] """ super().__init__(**kwargs) self.table = table @@ -1862,7 +1695,7 @@ class ComponentPurgeStatusResponse(_serialization.Model): :ivar status: Status of the operation represented by the requested Id. Required. Known values are: "pending" and "completed". - :vartype status: str or ~azure.mgmt.applicationinsights.models.PurgeState + :vartype status: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.PurgeState """ _validation = { @@ -1877,1212 +1710,572 @@ def __init__(self, *, status: Union[str, "_models.PurgeState"], **kwargs: Any) - """ :keyword status: Status of the operation represented by the requested Id. Required. Known values are: "pending" and "completed". - :paramtype status: str or ~azure.mgmt.applicationinsights.models.PurgeState + :paramtype status: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.PurgeState """ super().__init__(**kwargs) self.status = status -class ResourceAutoGenerated(_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. +class ErrorFieldContract(_serialization.Model): + """Error Field contract. - :ivar id: Fully qualified resource ID for the resource. E.g. - "/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.applicationinsights.models.SystemData + :ivar code: Property level error code. + :vartype code: str + :ivar message: Human-readable representation of property-level error. + :vartype message: str + :ivar target: Property name. + :vartype target: 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"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword code: Property level error code. + :paramtype code: str + :keyword message: Human-readable representation of property-level error. + :paramtype message: str + :keyword target: Property name. + :paramtype target: str + """ super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.system_data: Optional["_models.SystemData"] = None + self.code = code + self.message = message + self.target = target -class TrackedResourceAutoGenerated(ResourceAutoGenerated): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. +class ErrorResponse(_serialization.Model): + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ - All required parameters must be populated in order to send to server. + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } - :ivar id: Fully qualified resource ID for the resource. E.g. - "/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.applicationinsights.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message indicating why the operation failed. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class InnerError(_serialization.Model): + """Inner error. + + :ivar diagnosticcontext: Provides correlation for request. + :vartype diagnosticcontext: str + :ivar time: Request time. + :vartype time: ~datetime.datetime """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, + _attribute_map = { + "diagnosticcontext": {"key": "diagnosticcontext", "type": "str"}, + "time": {"key": "time", "type": "iso-8601"}, } + def __init__( + self, *, diagnosticcontext: Optional[str] = None, time: Optional[datetime.datetime] = None, **kwargs: Any + ) -> None: + """ + :keyword diagnosticcontext: Provides correlation for request. + :paramtype diagnosticcontext: str + :keyword time: Request time. + :paramtype time: ~datetime.datetime + """ + super().__init__(**kwargs) + self.diagnosticcontext = diagnosticcontext + self.time = time + + +class LinkProperties(_serialization.Model): + """Contains a sourceId and workbook resource id to link two resources. + + :ivar source_id: The source Azure resource id. + :vartype source_id: str + :ivar target_id: The workbook Azure resource id. + :vartype target_id: str + :ivar category: The category of workbook. + :vartype category: str + """ + _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, + "source_id": {"key": "sourceId", "type": "str"}, + "target_id": {"key": "targetId", "type": "str"}, + "category": {"key": "category", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + source_id: Optional[str] = None, + target_id: Optional[str] = None, + category: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str + :keyword source_id: The source Azure resource id. + :paramtype source_id: str + :keyword target_id: The workbook Azure resource id. + :paramtype target_id: str + :keyword category: The category of workbook. + :paramtype category: str """ super().__init__(**kwargs) - self.tags = tags - self.location = location + self.source_id = source_id + self.target_id = target_id + self.category = category -class DeletedWorkbookResource(TrackedResourceAutoGenerated): +class MyWorkbookResource(_serialization.Model): """An azure resource object. - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :ivar id: Azure resource Id. :vartype id: str - :ivar name: The name of the resource. + :ivar name: Azure resource name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: Azure resource type. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.applicationinsights.models.SystemData + :ivar location: Resource location. + :vartype location: str :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar kind: The kind of workbook. Only valid value is shared. "shared" - :vartype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookSharedTypeKind - :ivar etag: Resource etag. - :vartype etag: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - kind: Optional[Union[str, "_models.WorkbookSharedTypeKind"]] = None, - etag: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, **kwargs: Any ) -> None: """ + :keyword id: Azure resource Id. + :paramtype id: str + :keyword name: Azure resource name. + :paramtype name: str + :keyword type: Azure resource type. + :paramtype type: str + :keyword location: Resource location. + :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword kind: The kind of workbook. Only valid value is shared. "shared" - :paramtype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookSharedTypeKind - :keyword etag: Resource etag. - :paramtype etag: str """ - super().__init__(tags=tags, location=location, **kwargs) - self.kind = kind - self.etag = etag + super().__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.location = location + self.tags = tags -class DeletedWorkbook(DeletedWorkbookResource): - """A workbook definition. +class MyWorkbook(MyWorkbookResource): + """An Application Insights private workbook definition. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :ivar id: Azure resource Id. :vartype id: str - :ivar name: The name of the resource. + :ivar name: Azure resource name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: Azure resource type. :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.applicationinsights.models.SystemData + :ivar location: Resource location. + :vartype location: str :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar kind: The kind of workbook. Only valid value is shared. "shared" - :vartype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookSharedTypeKind - :ivar etag: Resource etag. - :vartype etag: str - :ivar display_name: The user-defined name (display name) of the workbook. + :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind + :ivar display_name: The user-defined name of the private workbook. :vartype display_name: str - :ivar serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. + :ivar serialized_data: Configuration of this particular private workbook. Configuration data is + a string containing valid JSON. :vartype serialized_data: str - :ivar version: Workbook schema version format, like 'Notebook/1.0', which should match the - workbook in serializedData. + :ivar version: This instance's version of the data model. This can change as new features are + added that can be marked private workbook. :vartype version: str :ivar time_modified: Date and time in UTC of the last modification that was made to this - workbook definition. - :vartype time_modified: ~datetime.datetime + private workbook definition. + :vartype time_modified: str :ivar category: Workbook category, as defined by the user at creation time. :vartype category: str - :ivar tags_properties_tags: Being deprecated, please use the other tags field. + :ivar tags_properties_tags: A list of 0 or more tags that are associated with this private + workbook definition. :vartype tags_properties_tags: list[str] - :ivar user_id: Unique user id of the specific user that owns this workbook. + :ivar user_id: Unique user id of the specific user that owns this private workbook. :vartype user_id: str - :ivar source_id: ResourceId for a source resource. + :ivar source_id: Optional resourceId for a source resource. :vartype source_id: str - :ivar storage_uri: The resourceId to the storage account when bring your own storage is used. - :vartype storage_uri: str - :ivar description: The description of the workbook. - :vartype description: str - :ivar revision: The unique revision id for this workbook definition. - :vartype revision: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, "time_modified": {"readonly": True}, "user_id": {"readonly": True}, - "revision": {"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"}, - "tags": {"key": "tags", "type": "{str}"}, "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, "serialized_data": {"key": "properties.serializedData", "type": "str"}, "version": {"key": "properties.version", "type": "str"}, - "time_modified": {"key": "properties.timeModified", "type": "iso-8601"}, + "time_modified": {"key": "properties.timeModified", "type": "str"}, "category": {"key": "properties.category", "type": "str"}, "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, "user_id": {"key": "properties.userId", "type": "str"}, "source_id": {"key": "properties.sourceId", "type": "str"}, - "storage_uri": {"key": "properties.storageUri", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "revision": {"key": "properties.revision", "type": "str"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - kind: Optional[Union[str, "_models.WorkbookSharedTypeKind"]] = None, - etag: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, display_name: Optional[str] = None, serialized_data: Optional[str] = None, version: Optional[str] = None, category: Optional[str] = None, - tags_properties_tags: Optional[List[str]] = None, + tags_properties_tags: Optional[list[str]] = None, source_id: Optional[str] = None, - storage_uri: Optional[str] = None, - description: Optional[str] = None, **kwargs: Any ) -> None: """ + :keyword id: Azure resource Id. + :paramtype id: str + :keyword name: Azure resource name. + :paramtype name: str + :keyword type: Azure resource type. + :paramtype type: str + :keyword location: Resource location. + :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword kind: The kind of workbook. Only valid value is shared. "shared" - :paramtype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookSharedTypeKind - :keyword etag: Resource etag. - :paramtype etag: str - :keyword display_name: The user-defined name (display name) of the workbook. + :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :paramtype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind + :keyword display_name: The user-defined name of the private workbook. :paramtype display_name: str - :keyword serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. + :keyword serialized_data: Configuration of this particular private workbook. Configuration data + is a string containing valid JSON. :paramtype serialized_data: str - :keyword version: Workbook schema version format, like 'Notebook/1.0', which should match the - workbook in serializedData. + :keyword version: This instance's version of the data model. This can change as new features + are added that can be marked private workbook. :paramtype version: str :keyword category: Workbook category, as defined by the user at creation time. :paramtype category: str - :keyword tags_properties_tags: Being deprecated, please use the other tags field. + :keyword tags_properties_tags: A list of 0 or more tags that are associated with this private + workbook definition. :paramtype tags_properties_tags: list[str] - :keyword source_id: ResourceId for a source resource. + :keyword source_id: Optional resourceId for a source resource. :paramtype source_id: str - :keyword storage_uri: The resourceId to the storage account when bring your own storage is - used. - :paramtype storage_uri: str - :keyword description: The description of the workbook. - :paramtype description: str """ - super().__init__(tags=tags, location=location, kind=kind, etag=etag, **kwargs) + super().__init__(id=id, name=name, type=type, location=location, tags=tags, **kwargs) + self.kind = kind self.display_name = display_name self.serialized_data = serialized_data self.version = version - self.time_modified: Optional[datetime.datetime] = None + self.time_modified: Optional[str] = None self.category = category self.tags_properties_tags = tags_properties_tags self.user_id: Optional[str] = None self.source_id = source_id - self.storage_uri = storage_uri - self.description = description - self.revision: Optional[str] = None -class DeletedWorkbookError(_serialization.Model): - """Error response. +class MyWorkbookError(_serialization.Model): + """Error message body that will indicate why the operation failed. - :ivar error: The error details. - :vartype error: ~azure.mgmt.applicationinsights.models.DeletedWorkbookErrorDefinition + :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar details: The list of invalid fields send in request, in case of validation error. + :vartype details: list[~azure.mgmt.applicationinsights.v2015_05_01.models.ErrorFieldContract] """ _attribute_map = { - "error": {"key": "error", "type": "DeletedWorkbookErrorDefinition"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[ErrorFieldContract]"}, } - def __init__(self, *, error: Optional["_models.DeletedWorkbookErrorDefinition"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + details: Optional[list["_models.ErrorFieldContract"]] = None, + **kwargs: Any + ) -> None: """ - :keyword error: The error details. - :paramtype error: ~azure.mgmt.applicationinsights.models.DeletedWorkbookErrorDefinition + :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :paramtype code: str + :keyword message: Human-readable representation of the error. + :paramtype message: str + :keyword details: The list of invalid fields send in request, in case of validation error. + :paramtype details: list[~azure.mgmt.applicationinsights.v2015_05_01.models.ErrorFieldContract] """ super().__init__(**kwargs) - self.error = error + self.code = code + self.message = message + self.details = details -class DeletedWorkbookErrorDefinition(_serialization.Model): - """Error definition. +class MyWorkbooksListResult(_serialization.Model): + """Workbook list result. Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Service specific error code which serves as the substatus for the HTTP error code. - :vartype code: str - :ivar message: Description of the error. - :vartype message: str - :ivar innererror: Internal error details. - :vartype innererror: ~azure.mgmt.applicationinsights.models.DeletedWorkbookInnerErrorTrace + :ivar value: An array of private workbooks. + :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook] """ _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "innererror": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "innererror": {"key": "innererror", "type": "DeletedWorkbookInnerErrorTrace"}, + "value": {"key": "value", "type": "[MyWorkbook]"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.innererror: Optional["_models.DeletedWorkbookInnerErrorTrace"] = None + self.value: Optional[list["_models.MyWorkbook"]] = None -class DeletedWorkbookInnerErrorTrace(_serialization.Model): - """Error details. - - Variables are only populated by the server, and will be ignored when sending a request. +class Operation(_serialization.Model): + """CDN REST API operation. - :ivar trace: detailed error trace. - :vartype trace: list[str] + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.applicationinsights.v2015_05_01.models.OperationDisplay """ - _validation = { - "trace": {"readonly": True}, - } - _attribute_map = { - "trace": {"key": "trace", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.applicationinsights.v2015_05_01.models.OperationDisplay + """ super().__init__(**kwargs) - self.trace: Optional[List[str]] = None - + self.name = name + self.display = display -class DeletedWorkbooksListResult(_serialization.Model): - """Workbook list result. - Variables are only populated by the server, and will be ignored when sending a request. +class OperationDisplay(_serialization.Model): + """The object that represents the operation. - :ivar value: An array of workbooks. - :vartype value: list[~azure.mgmt.applicationinsights.models.DeletedWorkbook] - :ivar next_link: - :vartype next_link: str + :ivar provider: Service provider: Microsoft.Cdn. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str """ - _validation = { - "value": {"readonly": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[DeletedWorkbook]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword next_link: - :paramtype next_link: str + :keyword provider: Service provider: Microsoft.Cdn. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed: Profile, endpoint, etc. + :paramtype resource: str + :keyword operation: Operation type: Read, write, delete, etc. + :paramtype operation: str """ super().__init__(**kwargs) - self.value: Optional[List["_models.DeletedWorkbook"]] = None - self.next_link = next_link + self.provider = provider + self.resource = resource + self.operation = operation -class ErrorFieldContract(_serialization.Model): - """Error Field contract. +class OperationListResult(_serialization.Model): + """Result of the request to list CDN operations. It contains a list of operations and a URL link + to get the next set of results. - :ivar code: Property level error code. - :vartype code: str - :ivar message: Human-readable representation of property-level error. - :vartype message: str - :ivar target: Property name. - :vartype target: str + :ivar value: List of CDN operations supported by the CDN resource provider. + :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, } def __init__( - self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any + self, *, value: Optional[list["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword code: Property level error code. - :paramtype code: str - :keyword message: Human-readable representation of property-level error. - :paramtype message: str - :keyword target: Property name. - :paramtype target: str + :keyword value: List of CDN operations supported by the CDN resource provider. + :paramtype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Operation] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str """ super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target + self.value = value + self.next_link = next_link -class ErrorResponse(_serialization.Model): - """Error response indicates Insights service is not able to process the incoming request. The - reason is provided in the error message. +class PrivateLinkScopedResource(_serialization.Model): + """The private link scope resource reference. - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - :ivar details: The list of invalid fields send in request, in case of validation error. - :vartype details: list[~azure.mgmt.applicationinsights.models.ErrorFieldContract] + :ivar resource_id: The full resource Id of the private link scope resource. + :vartype resource_id: str + :ivar scope_id: The private link scope unique Identifier. + :vartype scope_id: str """ _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[ErrorFieldContract]"}, + "resource_id": {"key": "ResourceId", "type": "str"}, + "scope_id": {"key": "ScopeId", "type": "str"}, } - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - details: Optional[List["_models.ErrorFieldContract"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, resource_id: Optional[str] = None, scope_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message indicating why the operation failed. - :paramtype message: str - :keyword details: The list of invalid fields send in request, in case of validation error. - :paramtype details: list[~azure.mgmt.applicationinsights.models.ErrorFieldContract] + :keyword resource_id: The full resource Id of the private link scope resource. + :paramtype resource_id: str + :keyword scope_id: The private link scope unique Identifier. + :paramtype scope_id: str """ super().__init__(**kwargs) - self.code = code - self.message = message - self.details = details + self.resource_id = resource_id + self.scope_id = scope_id -class ErrorResponseComponents(_serialization.Model): - """ErrorResponseComponents. +class TagsResource(_serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on a + WebTest instance. - :ivar error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :vartype error: ~azure.mgmt.applicationinsights.models.ErrorResponseComponentsError + :ivar tags: Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseComponentsError"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, error: Optional["_models.ErrorResponseComponentsError"] = None, **kwargs: Any) -> None: + def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :paramtype error: ~azure.mgmt.applicationinsights.models.ErrorResponseComponentsError + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.error = error + self.tags = tags -class ErrorResponseComponentsError(_serialization.Model): - """Error response indicates Insights service is not able to process the incoming request. The - reason is provided in the error message. +class WebtestsResource(_serialization.Model): + """An azure resource object. Variables are only populated by the server, and will be ignored when sending a request. - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] """ _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - - -class ErrorResponseLinkedStorage(_serialization.Model): - """ErrorResponseLinkedStorage. - - :ivar error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :vartype error: ~azure.mgmt.applicationinsights.models.ErrorResponseLinkedStorageError - """ - _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseLinkedStorageError"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, error: Optional["_models.ErrorResponseLinkedStorageError"] = None, **kwargs: Any) -> None: + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :paramtype error: ~azure.mgmt.applicationinsights.models.ErrorResponseLinkedStorageError + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.error = error + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.tags = tags -class ErrorResponseLinkedStorageError(_serialization.Model): - """Error response indicates Insights service is not able to process the incoming request. The - reason is provided in the error message. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - - -class HeaderField(_serialization.Model): - """A header to add to the WebTest. - - :ivar header_field_name: The name of the header. - :vartype header_field_name: str - :ivar header_field_value: The value of the header. - :vartype header_field_value: str - """ - - _attribute_map = { - "header_field_name": {"key": "key", "type": "str"}, - "header_field_value": {"key": "value", "type": "str"}, - } - - def __init__( - self, *, header_field_name: Optional[str] = None, header_field_value: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword header_field_name: The name of the header. - :paramtype header_field_name: str - :keyword header_field_value: The value of the header. - :paramtype header_field_value: str - """ - super().__init__(**kwargs) - self.header_field_name = header_field_name - self.header_field_value = header_field_value - - -class InnerError(_serialization.Model): - """Inner error. - - :ivar diagnosticcontext: Provides correlation for request. - :vartype diagnosticcontext: str - :ivar time: Request time. - :vartype time: ~datetime.datetime - """ - - _attribute_map = { - "diagnosticcontext": {"key": "diagnosticcontext", "type": "str"}, - "time": {"key": "time", "type": "iso-8601"}, - } - - def __init__( - self, *, diagnosticcontext: Optional[str] = None, time: Optional[datetime.datetime] = None, **kwargs: Any - ) -> None: - """ - :keyword diagnosticcontext: Provides correlation for request. - :paramtype diagnosticcontext: str - :keyword time: Request time. - :paramtype time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.diagnosticcontext = diagnosticcontext - self.time = time - - -class LiveTokenResponse(_serialization.Model): - """The response to a live token query. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar live_token: JWT token for accessing live metrics stream data. - :vartype live_token: str - """ - - _validation = { - "live_token": {"readonly": True}, - } - - _attribute_map = { - "live_token": {"key": "liveToken", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.live_token: Optional[str] = None - - -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.applicationinsights.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.applicationinsights.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.applicationinsights.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.applicationinsights.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class Operation(_serialization.Model): - """Azure Workbooks REST API operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.applicationinsights.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: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.applicationinsights.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(_serialization.Model): - """The object that represents the operation. - - :ivar provider: Service provider: Microsoft.Insights. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. - :vartype operation: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Service provider: Microsoft.Insights. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed: Profile, endpoint, etc. - :paramtype resource: str - :keyword operation: Operation type: Read, write, delete, etc. - :paramtype operation: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - - -class OperationInfo(_serialization.Model): - """Information about an operation. - - :ivar provider: Name of the provider. - :vartype provider: str - :ivar resource: Name of the resource type. - :vartype resource: str - :ivar operation: Name of the operation. - :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: Name of the provider. - :paramtype provider: str - :keyword resource: Name of the resource type. - :paramtype resource: str - :keyword operation: Name of the operation. - :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): - """Result of the request to list Azure Workbooks operations. It contains a list of operations and - a URL link to get the next set of results. - - :ivar value: List of Workbook operations supported by the Microsoft.Insights resource provider. - :vartype value: list[~azure.mgmt.applicationinsights.models.Operation] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of Workbook operations supported by the Microsoft.Insights resource - provider. - :paramtype value: list[~azure.mgmt.applicationinsights.models.Operation] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OperationLive(_serialization.Model): - """Represents an operation returned by the GetOperations request. - - :ivar name: Name of the operation. - :vartype name: str - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool - :ivar display: Display name of the operation. - :vartype display: ~azure.mgmt.applicationinsights.models.OperationInfo - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: JSON - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationInfo"}, - "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "object"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationInfo"] = None, - origin: Optional[str] = None, - properties: Optional[JSON] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the operation. - :paramtype name: str - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool - :keyword display: Display name of the operation. - :paramtype display: ~azure.mgmt.applicationinsights.models.OperationInfo - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: JSON - """ - super().__init__(**kwargs) - self.name = name - self.is_data_action = is_data_action - self.display = display - self.origin = origin - self.properties = properties - - -class OperationsListResult(_serialization.Model): - """Result of the List Operations operation. - - :ivar value: A collection of operations. - :vartype value: list[~azure.mgmt.applicationinsights.models.OperationLive] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationLive]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.OperationLive"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: A collection of operations. - :paramtype value: list[~azure.mgmt.applicationinsights.models.OperationLive] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PrivateLinkScopedResource(_serialization.Model): - """The private link scope resource reference. - - :ivar resource_id: The full resource Id of the private link scope resource. - :vartype resource_id: str - :ivar scope_id: The private link scope unique Identifier. - :vartype scope_id: str - """ - - _attribute_map = { - "resource_id": {"key": "ResourceId", "type": "str"}, - "scope_id": {"key": "ScopeId", "type": "str"}, - } - - def __init__(self, *, resource_id: Optional[str] = None, scope_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resource_id: The full resource Id of the private link scope resource. - :paramtype resource_id: str - :keyword scope_id: The private link scope unique Identifier. - :paramtype scope_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.scope_id = scope_id - - -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.applicationinsights.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.applicationinsights.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.applicationinsights.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.applicationinsights.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 TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on a - WebTest instance. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.client_id: Optional[str] = None - - -class WebtestsResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class WebTest(WebtestsResource): - """An Application Insights WebTest definition. +class WebTest(WebtestsResource): + """An Application Insights web test definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -3098,15 +2291,15 @@ class WebTest(WebtestsResource): :vartype location: str :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar kind: The kind of WebTest that this web test watches. Choices are ping, multistep and - standard. Known values are: "ping", "multistep", and "standard". - :vartype kind: str or ~azure.mgmt.applicationinsights.models.WebTestKind + :ivar kind: The kind of web test that this web test watches. Choices are ping and multistep. + Known values are: "ping" and "multistep". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestKind :ivar synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as the Name field. :vartype synthetic_monitor_id: str :ivar web_test_name: User defined name if this WebTest. :vartype web_test_name: str - :ivar description: User defined description for this WebTest. + :ivar description: Purpose/user defined descriptive test for this WebTest. :vartype description: str :ivar enabled: Is the test actively being monitored. :vartype enabled: bool @@ -3114,25 +2307,21 @@ class WebTest(WebtestsResource): :vartype frequency: int :ivar timeout: Seconds until this WebTest will timeout and fail. Default value is 30. :vartype timeout: int - :ivar web_test_kind: The kind of web test this is, valid choices are ping, multistep and - standard. Known values are: "ping", "multistep", and "standard". - :vartype web_test_kind: str or ~azure.mgmt.applicationinsights.models.WebTestKind + :ivar web_test_kind: The kind of web test this is, valid choices are ping and multistep. Known + values are: "ping" and "multistep". + :vartype web_test_kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestKind :ivar retry_enabled: Allow for retries should this WebTest fail. :vartype retry_enabled: bool :ivar locations: A list of where to physically run the tests from to give global coverage for accessibility of your application. - :vartype locations: list[~azure.mgmt.applicationinsights.models.WebTestGeolocation] + :vartype locations: list[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestGeolocation] :ivar configuration: An XML configuration specification for a WebTest. - :vartype configuration: ~azure.mgmt.applicationinsights.models.WebTestPropertiesConfiguration + :vartype configuration: + ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestPropertiesConfiguration :ivar provisioning_state: Current state of this component, whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. :vartype provisioning_state: str - :ivar request: The collection of request properties. - :vartype request: ~azure.mgmt.applicationinsights.models.WebTestPropertiesRequest - :ivar validation_rules: The collection of validation rule properties. - :vartype validation_rules: - ~azure.mgmt.applicationinsights.models.WebTestPropertiesValidationRules """ _validation = { @@ -3161,15 +2350,13 @@ class WebTest(WebtestsResource): "locations": {"key": "properties.Locations", "type": "[WebTestGeolocation]"}, "configuration": {"key": "properties.Configuration", "type": "WebTestPropertiesConfiguration"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "request": {"key": "properties.Request", "type": "WebTestPropertiesRequest"}, - "validation_rules": {"key": "properties.ValidationRules", "type": "WebTestPropertiesValidationRules"}, } def __init__( self, *, location: str, - tags: Optional[Dict[str, str]] = None, + tags: Optional[dict[str, str]] = None, kind: Optional[Union[str, "_models.WebTestKind"]] = None, synthetic_monitor_id: Optional[str] = None, web_test_name: Optional[str] = None, @@ -3179,10 +2366,8 @@ def __init__( timeout: int = 30, web_test_kind: Optional[Union[str, "_models.WebTestKind"]] = None, retry_enabled: Optional[bool] = None, - locations: Optional[List["_models.WebTestGeolocation"]] = None, + locations: Optional[list["_models.WebTestGeolocation"]] = None, configuration: Optional["_models.WebTestPropertiesConfiguration"] = None, - request: Optional["_models.WebTestPropertiesRequest"] = None, - validation_rules: Optional["_models.WebTestPropertiesValidationRules"] = None, **kwargs: Any ) -> None: """ @@ -3190,15 +2375,15 @@ def __init__( :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword kind: The kind of WebTest that this web test watches. Choices are ping, multistep and - standard. Known values are: "ping", "multistep", and "standard". - :paramtype kind: str or ~azure.mgmt.applicationinsights.models.WebTestKind + :keyword kind: The kind of web test that this web test watches. Choices are ping and multistep. + Known values are: "ping" and "multistep". + :paramtype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestKind :keyword synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as the Name field. :paramtype synthetic_monitor_id: str :keyword web_test_name: User defined name if this WebTest. :paramtype web_test_name: str - :keyword description: User defined description for this WebTest. + :keyword description: Purpose/user defined descriptive test for this WebTest. :paramtype description: str :keyword enabled: Is the test actively being monitored. :paramtype enabled: bool @@ -3207,21 +2392,18 @@ def __init__( :paramtype frequency: int :keyword timeout: Seconds until this WebTest will timeout and fail. Default value is 30. :paramtype timeout: int - :keyword web_test_kind: The kind of web test this is, valid choices are ping, multistep and - standard. Known values are: "ping", "multistep", and "standard". - :paramtype web_test_kind: str or ~azure.mgmt.applicationinsights.models.WebTestKind + :keyword web_test_kind: The kind of web test this is, valid choices are ping and multistep. + Known values are: "ping" and "multistep". + :paramtype web_test_kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestKind :keyword retry_enabled: Allow for retries should this WebTest fail. :paramtype retry_enabled: bool :keyword locations: A list of where to physically run the tests from to give global coverage for accessibility of your application. - :paramtype locations: list[~azure.mgmt.applicationinsights.models.WebTestGeolocation] + :paramtype locations: + list[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestGeolocation] :keyword configuration: An XML configuration specification for a WebTest. - :paramtype configuration: ~azure.mgmt.applicationinsights.models.WebTestPropertiesConfiguration - :keyword request: The collection of request properties. - :paramtype request: ~azure.mgmt.applicationinsights.models.WebTestPropertiesRequest - :keyword validation_rules: The collection of validation rule properties. - :paramtype validation_rules: - ~azure.mgmt.applicationinsights.models.WebTestPropertiesValidationRules + :paramtype configuration: + ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestPropertiesConfiguration """ super().__init__(location=location, tags=tags, **kwargs) self.kind = kind @@ -3236,15 +2418,13 @@ def __init__( self.locations = locations self.configuration = configuration self.provisioning_state: Optional[str] = None - self.request = request - self.validation_rules = validation_rules class WebTestGeolocation(_serialization.Model): - """Geo-physical location to run a WebTest from. You must specify one or more locations for the + """Geo-physical location to run a web test from. You must specify one or more locations for the test to run from. - :ivar location: Location ID for the WebTest to run from. + :ivar location: Location ID for the webtest to run from. :vartype location: str """ @@ -3254,7 +2434,7 @@ class WebTestGeolocation(_serialization.Model): def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword location: Location ID for the WebTest to run from. + :keyword location: Location ID for the webtest to run from. :paramtype location: str """ super().__init__(**kwargs) @@ -3262,13 +2442,13 @@ def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: class WebTestListResult(_serialization.Model): - """A list of 0 or more Application Insights WebTest definitions. + """A list of 0 or more Application Insights web test definitions. All required parameters must be populated in order to send to server. - :ivar value: Set of Application Insights WebTest definitions. Required. - :vartype value: list[~azure.mgmt.applicationinsights.models.WebTest] - :ivar next_link: The link to get the next part of the returned list of WebTest, should the + :ivar value: Set of Application Insights web test definitions. Required. + :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] + :ivar next_link: The link to get the next part of the returned list of web tests, should the return set be too large for a single request. May be null. :vartype next_link: str """ @@ -3282,11 +2462,11 @@ class WebTestListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: List["_models.WebTest"], next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: list["_models.WebTest"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: Set of Application Insights WebTest definitions. Required. - :paramtype value: list[~azure.mgmt.applicationinsights.models.WebTest] - :keyword next_link: The link to get the next part of the returned list of WebTest, should the + :keyword value: Set of Application Insights web test definitions. Required. + :paramtype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] + :keyword next_link: The link to get the next part of the returned list of web tests, should the return set be too large for a single request. May be null. :paramtype next_link: str """ @@ -3295,559 +2475,38 @@ def __init__(self, *, value: List["_models.WebTest"], next_link: Optional[str] = self.next_link = next_link -class WebTestPropertiesConfiguration(_serialization.Model): - """An XML configuration specification for a WebTest. - - :ivar web_test: The XML specification of a WebTest to run against an application. - :vartype web_test: str - """ - - _attribute_map = { - "web_test": {"key": "WebTest", "type": "str"}, - } - - def __init__(self, *, web_test: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword web_test: The XML specification of a WebTest to run against an application. - :paramtype web_test: str - """ - super().__init__(**kwargs) - self.web_test = web_test - - -class WebTestPropertiesRequest(_serialization.Model): - """The collection of request properties. - - :ivar request_url: Url location to test. - :vartype request_url: str - :ivar headers: List of headers and their values to add to the WebTest call. - :vartype headers: list[~azure.mgmt.applicationinsights.models.HeaderField] - :ivar http_verb: Http verb to use for this web test. - :vartype http_verb: str - :ivar request_body: Base64 encoded string body to send with this web test. - :vartype request_body: str - :ivar parse_dependent_requests: Parse Dependent request for this WebTest. - :vartype parse_dependent_requests: bool - :ivar follow_redirects: Follow redirects for this web test. - :vartype follow_redirects: bool - """ - - _attribute_map = { - "request_url": {"key": "RequestUrl", "type": "str"}, - "headers": {"key": "Headers", "type": "[HeaderField]"}, - "http_verb": {"key": "HttpVerb", "type": "str"}, - "request_body": {"key": "RequestBody", "type": "str"}, - "parse_dependent_requests": {"key": "ParseDependentRequests", "type": "bool"}, - "follow_redirects": {"key": "FollowRedirects", "type": "bool"}, - } - - def __init__( - self, - *, - request_url: Optional[str] = None, - headers: Optional[List["_models.HeaderField"]] = None, - http_verb: Optional[str] = None, - request_body: Optional[str] = None, - parse_dependent_requests: Optional[bool] = None, - follow_redirects: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword request_url: Url location to test. - :paramtype request_url: str - :keyword headers: List of headers and their values to add to the WebTest call. - :paramtype headers: list[~azure.mgmt.applicationinsights.models.HeaderField] - :keyword http_verb: Http verb to use for this web test. - :paramtype http_verb: str - :keyword request_body: Base64 encoded string body to send with this web test. - :paramtype request_body: str - :keyword parse_dependent_requests: Parse Dependent request for this WebTest. - :paramtype parse_dependent_requests: bool - :keyword follow_redirects: Follow redirects for this web test. - :paramtype follow_redirects: bool - """ - super().__init__(**kwargs) - self.request_url = request_url - self.headers = headers - self.http_verb = http_verb - self.request_body = request_body - self.parse_dependent_requests = parse_dependent_requests - self.follow_redirects = follow_redirects - - -class WebTestPropertiesValidationRules(_serialization.Model): - """The collection of validation rule properties. - - :ivar content_validation: The collection of content validation properties. - :vartype content_validation: - ~azure.mgmt.applicationinsights.models.WebTestPropertiesValidationRulesContentValidation - :ivar ssl_check: Checks to see if the SSL cert is still valid. - :vartype ssl_check: bool - :ivar ssl_cert_remaining_lifetime_check: A number of days to check still remain before the the - existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. - :vartype ssl_cert_remaining_lifetime_check: int - :ivar expected_http_status_code: Validate that the WebTest returns the http status code - provided. - :vartype expected_http_status_code: int - :ivar ignore_http_status_code: When set, validation will ignore the status code. - :vartype ignore_http_status_code: bool - """ - - _attribute_map = { - "content_validation": {"key": "ContentValidation", "type": "WebTestPropertiesValidationRulesContentValidation"}, - "ssl_check": {"key": "SSLCheck", "type": "bool"}, - "ssl_cert_remaining_lifetime_check": {"key": "SSLCertRemainingLifetimeCheck", "type": "int"}, - "expected_http_status_code": {"key": "ExpectedHttpStatusCode", "type": "int"}, - "ignore_http_status_code": {"key": "IgnoreHttpStatusCode", "type": "bool"}, - } - - def __init__( - self, - *, - content_validation: Optional["_models.WebTestPropertiesValidationRulesContentValidation"] = None, - ssl_check: Optional[bool] = None, - ssl_cert_remaining_lifetime_check: Optional[int] = None, - expected_http_status_code: Optional[int] = None, - ignore_http_status_code: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword content_validation: The collection of content validation properties. - :paramtype content_validation: - ~azure.mgmt.applicationinsights.models.WebTestPropertiesValidationRulesContentValidation - :keyword ssl_check: Checks to see if the SSL cert is still valid. - :paramtype ssl_check: bool - :keyword ssl_cert_remaining_lifetime_check: A number of days to check still remain before the - the existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. - :paramtype ssl_cert_remaining_lifetime_check: int - :keyword expected_http_status_code: Validate that the WebTest returns the http status code - provided. - :paramtype expected_http_status_code: int - :keyword ignore_http_status_code: When set, validation will ignore the status code. - :paramtype ignore_http_status_code: bool - """ - super().__init__(**kwargs) - self.content_validation = content_validation - self.ssl_check = ssl_check - self.ssl_cert_remaining_lifetime_check = ssl_cert_remaining_lifetime_check - self.expected_http_status_code = expected_http_status_code - self.ignore_http_status_code = ignore_http_status_code - - -class WebTestPropertiesValidationRulesContentValidation(_serialization.Model): # pylint: disable=name-too-long - """The collection of content validation properties. - - :ivar content_match: Content to look for in the return of the WebTest. Must not be null or - empty. - :vartype content_match: str - :ivar ignore_case: When set, this value makes the ContentMatch validation case insensitive. - :vartype ignore_case: bool - :ivar pass_if_text_found: When true, validation will pass if there is a match for the - ContentMatch string. If false, validation will fail if there is a match. - :vartype pass_if_text_found: bool - """ - - _attribute_map = { - "content_match": {"key": "ContentMatch", "type": "str"}, - "ignore_case": {"key": "IgnoreCase", "type": "bool"}, - "pass_if_text_found": {"key": "PassIfTextFound", "type": "bool"}, - } - - def __init__( - self, - *, - content_match: Optional[str] = None, - ignore_case: Optional[bool] = None, - pass_if_text_found: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword content_match: Content to look for in the return of the WebTest. Must not be null or - empty. - :paramtype content_match: str - :keyword ignore_case: When set, this value makes the ContentMatch validation case insensitive. - :paramtype ignore_case: bool - :keyword pass_if_text_found: When true, validation will pass if there is a match for the - ContentMatch string. If false, validation will fail if there is a match. - :paramtype pass_if_text_found: bool - """ - super().__init__(**kwargs) - self.content_match = content_match - self.ignore_case = ignore_case - self.pass_if_text_found = pass_if_text_found - - -class WorkbookResource(TrackedResource): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Identity used for BYOS. - :vartype identity: ~azure.mgmt.applicationinsights.models.WorkbookResourceIdentity - :ivar kind: The kind of workbook. Only valid value is shared. "shared" - :vartype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookSharedTypeKind - :ivar etag: Resource etag. - :vartype etag: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "WorkbookResourceIdentity"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.WorkbookResourceIdentity"] = None, - kind: Optional[Union[str, "_models.WorkbookSharedTypeKind"]] = None, - etag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Identity used for BYOS. - :paramtype identity: ~azure.mgmt.applicationinsights.models.WorkbookResourceIdentity - :keyword kind: The kind of workbook. Only valid value is shared. "shared" - :paramtype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookSharedTypeKind - :keyword etag: Resource etag. - :paramtype etag: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.kind = kind - self.etag = etag - - -class Workbook(WorkbookResource): - """A workbook definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Identity used for BYOS. - :vartype identity: ~azure.mgmt.applicationinsights.models.WorkbookResourceIdentity - :ivar kind: The kind of workbook. Only valid value is shared. "shared" - :vartype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookSharedTypeKind - :ivar etag: Resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.applicationinsights.models.SystemData - :ivar display_name: The user-defined name (display name) of the workbook. - :vartype display_name: str - :ivar serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :vartype serialized_data: str - :ivar version: Workbook schema version format, like 'Notebook/1.0', which should match the - workbook in serializedData. - :vartype version: str - :ivar time_modified: Date and time in UTC of the last modification that was made to this - workbook definition. - :vartype time_modified: ~datetime.datetime - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar tags_properties_tags: Being deprecated, please use the other tags field. - :vartype tags_properties_tags: list[str] - :ivar user_id: Unique user id of the specific user that owns this workbook. - :vartype user_id: str - :ivar source_id: ResourceId for a source resource. - :vartype source_id: str - :ivar storage_uri: The resourceId to the storage account when bring your own storage is used. - :vartype storage_uri: str - :ivar description: The description of the workbook. - :vartype description: str - :ivar revision: The unique revision id for this workbook definition. - :vartype revision: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "time_modified": {"readonly": True}, - "user_id": {"readonly": True}, - "revision": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "WorkbookResourceIdentity"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "time_modified": {"key": "properties.timeModified", "type": "iso-8601"}, - "category": {"key": "properties.category", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - "user_id": {"key": "properties.userId", "type": "str"}, - "source_id": {"key": "properties.sourceId", "type": "str"}, - "storage_uri": {"key": "properties.storageUri", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "revision": {"key": "properties.revision", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.WorkbookResourceIdentity"] = None, - kind: Optional[Union[str, "_models.WorkbookSharedTypeKind"]] = None, - etag: Optional[str] = None, - display_name: Optional[str] = None, - serialized_data: Optional[str] = None, - version: Optional[str] = None, - category: Optional[str] = None, - tags_properties_tags: Optional[List[str]] = None, - source_id: Optional[str] = None, - storage_uri: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Identity used for BYOS. - :paramtype identity: ~azure.mgmt.applicationinsights.models.WorkbookResourceIdentity - :keyword kind: The kind of workbook. Only valid value is shared. "shared" - :paramtype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookSharedTypeKind - :keyword etag: Resource etag. - :paramtype etag: str - :keyword display_name: The user-defined name (display name) of the workbook. - :paramtype display_name: str - :keyword serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :paramtype serialized_data: str - :keyword version: Workbook schema version format, like 'Notebook/1.0', which should match the - workbook in serializedData. - :paramtype version: str - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword tags_properties_tags: Being deprecated, please use the other tags field. - :paramtype tags_properties_tags: list[str] - :keyword source_id: ResourceId for a source resource. - :paramtype source_id: str - :keyword storage_uri: The resourceId to the storage account when bring your own storage is - used. - :paramtype storage_uri: str - :keyword description: The description of the workbook. - :paramtype description: str - """ - super().__init__(tags=tags, location=location, identity=identity, kind=kind, etag=etag, **kwargs) - self.system_data: Optional["_models.SystemData"] = None - self.display_name = display_name - self.serialized_data = serialized_data - self.version = version - self.time_modified: Optional[datetime.datetime] = None - self.category = category - self.tags_properties_tags = tags_properties_tags - self.user_id: Optional[str] = None - self.source_id = source_id - self.storage_uri = storage_uri - self.description = description - self.revision: Optional[str] = None - - -class WorkbookError(_serialization.Model): - """Error response. - - :ivar error: The error details. - :vartype error: ~azure.mgmt.applicationinsights.models.WorkbookErrorDefinition - """ - - _attribute_map = { - "error": {"key": "error", "type": "WorkbookErrorDefinition"}, - } - - def __init__(self, *, error: Optional["_models.WorkbookErrorDefinition"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error details. - :paramtype error: ~azure.mgmt.applicationinsights.models.WorkbookErrorDefinition - """ - super().__init__(**kwargs) - self.error = error - - -class WorkbookErrorDefinition(_serialization.Model): - """Error definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Service specific error code which serves as the substatus for the HTTP error code. - :vartype code: str - :ivar message: Description of the error. - :vartype message: str - :ivar innererror: Internal error details. - :vartype innererror: ~azure.mgmt.applicationinsights.models.WorkbookInnerErrorTrace - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "innererror": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "innererror": {"key": "innererror", "type": "WorkbookInnerErrorTrace"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.innererror: Optional["_models.WorkbookInnerErrorTrace"] = None - - -class WorkbookInnerErrorTrace(_serialization.Model): - """Error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar trace: detailed error trace. - :vartype trace: list[str] - """ - - _validation = { - "trace": {"readonly": True}, - } - - _attribute_map = { - "trace": {"key": "trace", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.trace: Optional[List[str]] = None - - -class WorkbookResourceIdentity(ManagedServiceIdentity): - """Identity used for BYOS. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.applicationinsights.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.applicationinsights.models.UserAssignedIdentity] - """ - - -class WorkbooksListResult(_serialization.Model): - """Workbook list result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: An array of workbooks. - :vartype value: list[~azure.mgmt.applicationinsights.models.Workbook] - :ivar next_link: - :vartype next_link: str - """ +class WebTestPropertiesConfiguration(_serialization.Model): + """An XML configuration specification for a WebTest. - _validation = { - "value": {"readonly": True}, - } + :ivar web_test: The XML specification of a WebTest to run against an application. + :vartype web_test: str + """ _attribute_map = { - "value": {"key": "value", "type": "[Workbook]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "web_test": {"key": "WebTest", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, web_test: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword next_link: - :paramtype next_link: str + :keyword web_test: The XML specification of a WebTest to run against an application. + :paramtype web_test: str """ super().__init__(**kwargs) - self.value: Optional[List["_models.Workbook"]] = None - self.next_link = next_link + self.web_test = web_test -class WorkbookTemplateResource(_serialization.Model): +class WorkbookResource(_serialization.Model): """An azure resource object. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Azure resource Id. :vartype id: str :ivar name: Azure resource name. :vartype name: str :ivar type: Azure resource type. :vartype type: str - :ivar location: Resource location. Required. + :ivar location: Resource location. :vartype location: str :ivar tags: Resource tags. :vartype tags: dict[str, str] @@ -3857,7 +2516,6 @@ class WorkbookTemplateResource(_serialization.Model): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, } _attribute_map = { @@ -3868,9 +2526,9 @@ class WorkbookTemplateResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__(self, *, location: Optional[str] = None, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword location: Resource location. Required. + :keyword location: Resource location. :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -3883,43 +2541,58 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.tags = tags -class WorkbookTemplate(WorkbookTemplateResource): - """An Application Insights workbook template definition. +class Workbook(WorkbookResource): + """An Application Insights workbook definition. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. - :ivar id: Azure resource Id. :vartype id: str :ivar name: Azure resource name. :vartype name: str :ivar type: Azure resource type. :vartype type: str - :ivar location: Resource location. Required. + :ivar location: Resource location. :vartype location: str :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :vartype priority: int - :ivar author: Information about the author of the workbook template. - :vartype author: str - :ivar template_data: Valid JSON object containing workbook template payload. - :vartype template_data: JSON - :ivar galleries: Workbook galleries supported by the template. - :vartype galleries: list[~azure.mgmt.applicationinsights.models.WorkbookTemplateGallery] - :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages - supported by the Azure portal. - :vartype localized: dict[str, - list[~azure.mgmt.applicationinsights.models.WorkbookTemplateLocalizedGallery]] + :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind + :ivar name_properties_name: The user-defined name of the workbook. + :vartype name_properties_name: str + :ivar serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :vartype serialized_data: str + :ivar version: This instance's version of the data model. This can change as new features are + added that can be marked workbook. + :vartype version: str + :ivar workbook_id: Internally assigned unique id of the workbook definition. + :vartype workbook_id: str + :ivar shared_type_kind: Enum indicating if this workbook definition is owned by a specific user + or is shared between all users with access to the Application Insights component. Known values + are: "user" and "shared". + :vartype shared_type_kind: str or + ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind + :ivar time_modified: Date and time in UTC of the last modification that was made to this + workbook definition. + :vartype time_modified: str + :ivar category: Workbook category, as defined by the user at creation time. + :vartype category: str + :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook + definition. + :vartype tags_properties_tags: list[str] + :ivar user_id: Unique user id of the specific user that owns this workbook. + :vartype user_id: str + :ivar source_resource_id: Optional resourceId for a source resource. + :vartype source_resource_id: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "location": {"required": True}, + "time_modified": {"readonly": True}, } _attribute_map = { @@ -3928,73 +2601,84 @@ class WorkbookTemplate(WorkbookTemplateResource): "type": {"key": "type", "type": "str"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, - "priority": {"key": "properties.priority", "type": "int"}, - "author": {"key": "properties.author", "type": "str"}, - "template_data": {"key": "properties.templateData", "type": "object"}, - "galleries": {"key": "properties.galleries", "type": "[WorkbookTemplateGallery]"}, - "localized": {"key": "properties.localized", "type": "{[WorkbookTemplateLocalizedGallery]}"}, + "kind": {"key": "kind", "type": "str"}, + "name_properties_name": {"key": "properties.name", "type": "str"}, + "serialized_data": {"key": "properties.serializedData", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "workbook_id": {"key": "properties.workbookId", "type": "str"}, + "shared_type_kind": {"key": "properties.kind", "type": "str"}, + "time_modified": {"key": "properties.timeModified", "type": "str"}, + "category": {"key": "properties.category", "type": "str"}, + "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, + "user_id": {"key": "properties.userId", "type": "str"}, + "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"}, } def __init__( self, *, - location: str, - tags: Optional[Dict[str, str]] = None, - priority: Optional[int] = None, - author: Optional[str] = None, - template_data: Optional[JSON] = None, - galleries: Optional[List["_models.WorkbookTemplateGallery"]] = None, - localized: Optional[Dict[str, List["_models.WorkbookTemplateLocalizedGallery"]]] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, + name_properties_name: Optional[str] = None, + serialized_data: Optional[str] = None, + version: Optional[str] = None, + workbook_id: Optional[str] = None, + shared_type_kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, + category: Optional[str] = None, + tags_properties_tags: Optional[list[str]] = None, + user_id: Optional[str] = None, + source_resource_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword location: Resource location. Required. + :keyword location: Resource location. :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :paramtype priority: int - :keyword author: Information about the author of the workbook template. - :paramtype author: str - :keyword template_data: Valid JSON object containing workbook template payload. - :paramtype template_data: JSON - :keyword galleries: Workbook galleries supported by the template. - :paramtype galleries: list[~azure.mgmt.applicationinsights.models.WorkbookTemplateGallery] - :keyword localized: Key value pair of localized gallery. Each key is the locale code of - languages supported by the Azure portal. - :paramtype localized: dict[str, - list[~azure.mgmt.applicationinsights.models.WorkbookTemplateLocalizedGallery]] + :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :paramtype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind + :keyword name_properties_name: The user-defined name of the workbook. + :paramtype name_properties_name: str + :keyword serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :paramtype serialized_data: str + :keyword version: This instance's version of the data model. This can change as new features + are added that can be marked workbook. + :paramtype version: str + :keyword workbook_id: Internally assigned unique id of the workbook definition. + :paramtype workbook_id: str + :keyword shared_type_kind: Enum indicating if this workbook definition is owned by a specific + user or is shared between all users with access to the Application Insights component. Known + values are: "user" and "shared". + :paramtype shared_type_kind: str or + ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind + :keyword category: Workbook category, as defined by the user at creation time. + :paramtype category: str + :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook + definition. + :paramtype tags_properties_tags: list[str] + :keyword user_id: Unique user id of the specific user that owns this workbook. + :paramtype user_id: str + :keyword source_resource_id: Optional resourceId for a source resource. + :paramtype source_resource_id: str """ super().__init__(location=location, tags=tags, **kwargs) - self.priority = priority - self.author = author - self.template_data = template_data - self.galleries = galleries - self.localized = localized - - -class WorkbookTemplateError(_serialization.Model): - """Error message that will indicate why the operation failed. - - :ivar error: Error message object that will indicate why the operation failed. - :vartype error: ~azure.mgmt.applicationinsights.models.WorkbookTemplateErrorBody - """ - - _attribute_map = { - "error": {"key": "error", "type": "WorkbookTemplateErrorBody"}, - } - - def __init__(self, *, error: Optional["_models.WorkbookTemplateErrorBody"] = None, **kwargs: Any) -> None: - """ - :keyword error: Error message object that will indicate why the operation failed. - :paramtype error: ~azure.mgmt.applicationinsights.models.WorkbookTemplateErrorBody - """ - super().__init__(**kwargs) - self.error = error + self.kind = kind + self.name_properties_name = name_properties_name + self.serialized_data = serialized_data + self.version = version + self.workbook_id = workbook_id + self.shared_type_kind = shared_type_kind + self.time_modified: Optional[str] = None + self.category = category + self.tags_properties_tags = tags_properties_tags + self.user_id = user_id + self.source_resource_id = source_resource_id -class WorkbookTemplateErrorBody(_serialization.Model): +class WorkbookError(_serialization.Model): """Error message body that will indicate why the operation failed. :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error @@ -4003,14 +2687,13 @@ class WorkbookTemplateErrorBody(_serialization.Model): :ivar message: Human-readable representation of the error. :vartype message: str :ivar details: The list of invalid fields send in request, in case of validation error. - :vartype details: - list[~azure.mgmt.applicationinsights.models.WorkbookTemplateErrorFieldContract] + :vartype details: list[~azure.mgmt.applicationinsights.v2015_05_01.models.ErrorFieldContract] """ _attribute_map = { "code": {"key": "code", "type": "str"}, "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[WorkbookTemplateErrorFieldContract]"}, + "details": {"key": "details", "type": "[ErrorFieldContract]"}, } def __init__( @@ -4018,7 +2701,7 @@ def __init__( *, code: Optional[str] = None, message: Optional[str] = None, - details: Optional[List["_models.WorkbookTemplateErrorFieldContract"]] = None, + details: Optional[list["_models.ErrorFieldContract"]] = None, **kwargs: Any ) -> None: """ @@ -4028,8 +2711,7 @@ def __init__( :keyword message: Human-readable representation of the error. :paramtype message: str :keyword details: The list of invalid fields send in request, in case of validation error. - :paramtype details: - list[~azure.mgmt.applicationinsights.models.WorkbookTemplateErrorFieldContract] + :paramtype details: list[~azure.mgmt.applicationinsights.v2015_05_01.models.ErrorFieldContract] """ super().__init__(**kwargs) self.code = code @@ -4037,287 +2719,27 @@ def __init__( self.details = details -class WorkbookTemplateErrorFieldContract(_serialization.Model): - """Error Field contract. - - :ivar code: Property level error code. - :vartype code: str - :ivar message: Human-readable representation of property-level error. - :vartype message: str - :ivar target: Property name. - :vartype target: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__( - self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword code: Property level error code. - :paramtype code: str - :keyword message: Human-readable representation of property-level error. - :paramtype message: str - :keyword target: Property name. - :paramtype target: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - - -class WorkbookTemplateGallery(_serialization.Model): - """Gallery information for a workbook template. - - :ivar name: Name of the workbook template in the gallery. - :vartype name: str - :ivar category: Category for the gallery. - :vartype category: str - :ivar type: Type of workbook supported by the workbook template. - :vartype type: str - :ivar order: Order of the template within the gallery. - :vartype order: int - :ivar resource_type: Azure resource type supported by the gallery. - :vartype resource_type: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "order": {"key": "order", "type": "int"}, - "resource_type": {"key": "resourceType", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - category: Optional[str] = None, - type: Optional[str] = None, - order: Optional[int] = None, - resource_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the workbook template in the gallery. - :paramtype name: str - :keyword category: Category for the gallery. - :paramtype category: str - :keyword type: Type of workbook supported by the workbook template. - :paramtype type: str - :keyword order: Order of the template within the gallery. - :paramtype order: int - :keyword resource_type: Azure resource type supported by the gallery. - :paramtype resource_type: str - """ - super().__init__(**kwargs) - self.name = name - self.category = category - self.type = type - self.order = order - self.resource_type = resource_type - - -class WorkbookTemplateLocalizedGallery(_serialization.Model): - """Localized template data and gallery information. - - :ivar template_data: Valid JSON object containing workbook template payload. - :vartype template_data: JSON - :ivar galleries: Workbook galleries supported by the template. - :vartype galleries: list[~azure.mgmt.applicationinsights.models.WorkbookTemplateGallery] - """ - - _attribute_map = { - "template_data": {"key": "templateData", "type": "object"}, - "galleries": {"key": "galleries", "type": "[WorkbookTemplateGallery]"}, - } - - def __init__( - self, - *, - template_data: Optional[JSON] = None, - galleries: Optional[List["_models.WorkbookTemplateGallery"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword template_data: Valid JSON object containing workbook template payload. - :paramtype template_data: JSON - :keyword galleries: Workbook galleries supported by the template. - :paramtype galleries: list[~azure.mgmt.applicationinsights.models.WorkbookTemplateGallery] - """ - super().__init__(**kwargs) - self.template_data = template_data - self.galleries = galleries - - -class WorkbookTemplatesListResult(_serialization.Model): - """WorkbookTemplate list result. - - :ivar value: An array of workbook templates. - :vartype value: list[~azure.mgmt.applicationinsights.models.WorkbookTemplate] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[WorkbookTemplate]"}, - } - - def __init__(self, *, value: Optional[List["_models.WorkbookTemplate"]] = None, **kwargs: Any) -> None: - """ - :keyword value: An array of workbook templates. - :paramtype value: list[~azure.mgmt.applicationinsights.models.WorkbookTemplate] - """ - super().__init__(**kwargs) - self.value = value - +class WorkbooksListResult(_serialization.Model): + """Workbook list result. -class WorkbookTemplateUpdateParameters(_serialization.Model): - """The parameters that can be provided when updating workbook template. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :vartype priority: int - :ivar author: Information about the author of the workbook template. - :vartype author: str - :ivar template_data: Valid JSON object containing workbook template payload. - :vartype template_data: JSON - :ivar galleries: Workbook galleries supported by the template. - :vartype galleries: list[~azure.mgmt.applicationinsights.models.WorkbookTemplateGallery] - :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages - supported by the Azure portal. - :vartype localized: dict[str, - list[~azure.mgmt.applicationinsights.models.WorkbookTemplateLocalizedGallery]] + :ivar value: An array of workbooks. + :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook] """ - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "priority": {"key": "properties.priority", "type": "int"}, - "author": {"key": "properties.author", "type": "str"}, - "template_data": {"key": "properties.templateData", "type": "object"}, - "galleries": {"key": "properties.galleries", "type": "[WorkbookTemplateGallery]"}, - "localized": {"key": "properties.localized", "type": "{[WorkbookTemplateLocalizedGallery]}"}, + _validation = { + "value": {"readonly": True}, } - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - priority: Optional[int] = None, - author: Optional[str] = None, - template_data: Optional[JSON] = None, - galleries: Optional[List["_models.WorkbookTemplateGallery"]] = None, - localized: Optional[Dict[str, List["_models.WorkbookTemplateLocalizedGallery"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :paramtype priority: int - :keyword author: Information about the author of the workbook template. - :paramtype author: str - :keyword template_data: Valid JSON object containing workbook template payload. - :paramtype template_data: JSON - :keyword galleries: Workbook galleries supported by the template. - :paramtype galleries: list[~azure.mgmt.applicationinsights.models.WorkbookTemplateGallery] - :keyword localized: Key value pair of localized gallery. Each key is the locale code of - languages supported by the Azure portal. - :paramtype localized: dict[str, - list[~azure.mgmt.applicationinsights.models.WorkbookTemplateLocalizedGallery]] - """ - super().__init__(**kwargs) - self.tags = tags - self.priority = priority - self.author = author - self.template_data = template_data - self.galleries = galleries - self.localized = localized - - -class WorkbookUpdateParameters(_serialization.Model): - """The parameters that can be provided when updating workbook properties properties. - - :ivar kind: The kind of workbook. Only valid value is shared. "shared" - :vartype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookUpdateSharedTypeKind - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar display_name: The user-defined name (display name) of the workbook. - :vartype display_name: str - :ivar serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :vartype serialized_data: str - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :vartype tags_properties_tags: list[str] - :ivar description: The description of the workbook. - :vartype description: str - :ivar revision: The unique revision id for this workbook definition. - :vartype revision: str - """ - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "category": {"key": "properties.category", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - "description": {"key": "properties.description", "type": "str"}, - "revision": {"key": "properties.revision", "type": "str"}, + "value": {"key": "value", "type": "[Workbook]"}, } - def __init__( - self, - *, - kind: Optional[Union[str, "_models.WorkbookUpdateSharedTypeKind"]] = None, - tags: Optional[Dict[str, str]] = None, - display_name: Optional[str] = None, - serialized_data: Optional[str] = None, - category: Optional[str] = None, - tags_properties_tags: Optional[List[str]] = None, - description: Optional[str] = None, - revision: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword kind: The kind of workbook. Only valid value is shared. "shared" - :paramtype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookUpdateSharedTypeKind - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword display_name: The user-defined name (display name) of the workbook. - :paramtype display_name: str - :keyword serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :paramtype serialized_data: str - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :paramtype tags_properties_tags: list[str] - :keyword description: The description of the workbook. - :paramtype description: str - :keyword revision: The unique revision id for this workbook definition. - :paramtype revision: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.kind = kind - self.tags = tags - self.display_name = display_name - self.serialized_data = serialized_data - self.category = category - self.tags_properties_tags = tags_properties_tags - self.description = description - self.revision = revision + self.value: Optional[list["_models.Workbook"]] = None class WorkItemConfiguration(_serialization.Model): @@ -4381,7 +2803,7 @@ class WorkItemConfigurationError(_serialization.Model): :ivar message: Error message. :vartype message: str :ivar innererror: Inner error. - :vartype innererror: ~azure.mgmt.applicationinsights.models.InnerError + :vartype innererror: ~azure.mgmt.applicationinsights.v2015_05_01.models.InnerError """ _attribute_map = { @@ -4404,7 +2826,7 @@ def __init__( :keyword message: Error message. :paramtype message: str :keyword innererror: Inner error. - :paramtype innererror: ~azure.mgmt.applicationinsights.models.InnerError + :paramtype innererror: ~azure.mgmt.applicationinsights.v2015_05_01.models.InnerError """ super().__init__(**kwargs) self.code = code @@ -4418,7 +2840,7 @@ class WorkItemConfigurationsListResult(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: An array of work item configurations. - :vartype value: list[~azure.mgmt.applicationinsights.models.WorkItemConfiguration] + :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration] """ _validation = { @@ -4432,7 +2854,7 @@ class WorkItemConfigurationsListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value: Optional[List["_models.WorkItemConfiguration"]] = None + self.value: Optional[list["_models.WorkItemConfiguration"]] = None class WorkItemCreateConfiguration(_serialization.Model): @@ -4461,7 +2883,7 @@ def __init__( connector_id: Optional[str] = None, connector_data_configuration: Optional[str] = None, validate_only: Optional[bool] = None, - work_item_properties: Optional[Dict[str, str]] = None, + work_item_properties: Optional[dict[str, str]] = None, **kwargs: Any ) -> None: """ diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_patch.py similarity index 89% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_patch.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_patch.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/__init__.py similarity index 84% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/__init__.py index be555323ff9d..a6e31fd3e1fd 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/__init__.py @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._components_operations import ComponentsOperations # type: ignore +from ._operations import Operations # type: ignore from ._annotations_operations import AnnotationsOperations # type: ignore from ._api_keys_operations import APIKeysOperations # type: ignore from ._export_configurations_operations import ExportConfigurationsOperations # type: ignore @@ -21,24 +21,21 @@ from ._component_feature_capabilities_operations import ComponentFeatureCapabilitiesOperations # type: ignore from ._component_available_features_operations import ComponentAvailableFeaturesOperations # type: ignore from ._proactive_detection_configurations_operations import ProactiveDetectionConfigurationsOperations # type: ignore +from ._components_operations import ComponentsOperations # type: ignore from ._work_item_configurations_operations import WorkItemConfigurationsOperations # type: ignore from ._favorites_operations import FavoritesOperations # type: ignore from ._web_test_locations_operations import WebTestLocationsOperations # type: ignore from ._web_tests_operations import WebTestsOperations # type: ignore from ._analytics_items_operations import AnalyticsItemsOperations # type: ignore -from ._operations import Operations # type: ignore -from ._workbook_templates_operations import WorkbookTemplatesOperations # type: ignore from ._workbooks_operations import WorkbooksOperations # type: ignore -from ._live_token_operations import LiveTokenOperations # type: ignore -from ._component_linked_storage_accounts_operations import ComponentLinkedStorageAccountsOperations # type: ignore -from ._deleted_workbooks_operations import DeletedWorkbooksOperations # type: ignore +from ._my_workbooks_operations import MyWorkbooksOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ComponentsOperations", + "Operations", "AnnotationsOperations", "APIKeysOperations", "ExportConfigurationsOperations", @@ -47,17 +44,14 @@ "ComponentFeatureCapabilitiesOperations", "ComponentAvailableFeaturesOperations", "ProactiveDetectionConfigurationsOperations", + "ComponentsOperations", "WorkItemConfigurationsOperations", "FavoritesOperations", "WebTestLocationsOperations", "WebTestsOperations", "AnalyticsItemsOperations", - "Operations", - "WorkbookTemplatesOperations", "WorkbooksOperations", - "LiveTokenOperations", - "ComponentLinkedStorageAccountsOperations", - "DeletedWorkbooksOperations", + "MyWorkbooksOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_analytics_items_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_analytics_items_operations.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_analytics_items_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_analytics_items_operations.py index 7e4fc0c4fd9d..7f9a5f717c0a 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_analytics_items_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_analytics_items_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -30,7 +30,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -219,7 +220,7 @@ class AnalyticsItemsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`analytics_items` attribute. """ @@ -255,19 +256,20 @@ def list( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param scope: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "shared" and "user". Default value is None. - :type scope: str or ~azure.mgmt.applicationinsights.models.ItemScope + :type scope: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScope :param type: Enum indicating the type of the Analytics item. Known values are: "none", "query", "function", "folder", and "recent". Default value is "none". - :type type: str or ~azure.mgmt.applicationinsights.models.ItemTypeParameter + :type type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemTypeParameter :param include_content: Flag indicating whether or not to return the content of each applicable item. If false, only return the item information. Default value is None. :type include_content: bool :return: list of ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem] + :rtype: + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -281,7 +283,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.ApplicationInsightsComponentAnalyticsItem]] = kwargs.pop("cls", None) _request = build_list_request( @@ -336,7 +338,7 @@ def get( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param id: The Id of a specific item defined in the Application Insights component. Default value is None. :type id: str @@ -344,7 +346,8 @@ def get( value is None. :type name: str :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -358,7 +361,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) _request = build_get_request( @@ -414,11 +417,11 @@ def put( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param item_properties: Properties that need to be specified to create a new item and add it to an Application Insights component. Required. :type item_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem :param override_item: Flag indicating whether or not to force save an item. This allows overriding an item if it already exists. Default value is None. :type override_item: bool @@ -426,7 +429,8 @@ def put( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem :raises ~azure.core.exceptions.HttpResponseError: """ @@ -452,7 +456,7 @@ def put( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param item_properties: Properties that need to be specified to create a new item and add it to an Application Insights component. Required. :type item_properties: IO[bytes] @@ -463,7 +467,8 @@ def put( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem :raises ~azure.core.exceptions.HttpResponseError: """ @@ -487,17 +492,19 @@ def put( :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param item_properties: Properties that need to be specified to create a new item and add it to an Application Insights component. Is either a ApplicationInsightsComponentAnalyticsItem type or a IO[bytes] type. Required. :type item_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem or + IO[bytes] :param override_item: Flag indicating whether or not to force save an item. This allows overriding an item if it already exists. Default value is None. :type override_item: bool :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -511,7 +518,7 @@ def put( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) @@ -576,7 +583,7 @@ def delete( # pylint: disable=inconsistent-return-statements :param scope_path: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Known values are: "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath :param id: The Id of a specific item defined in the Application Insights component. Default value is None. :type id: str @@ -598,7 +605,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_annotations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_annotations_operations.py similarity index 91% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_annotations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_annotations_operations.py index 624de7ba9c00..a9576b57445e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_annotations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_annotations_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -31,7 +32,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -176,7 +178,7 @@ class AnnotationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`annotations` attribute. """ @@ -208,13 +210,14 @@ def list( :param end: The end time to query for annotations. Required. :type end: str :return: An iterator like instance of either Annotation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.Annotation] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] :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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AnnotationsListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -241,7 +244,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -264,7 +278,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.AnnotationError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.AnnotationError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -290,12 +307,12 @@ def create( :type resource_name: str :param annotation_properties: Properties that need to be specified to create an annotation of a Application Insights component. Required. - :type annotation_properties: ~azure.mgmt.applicationinsights.models.Annotation + :type annotation_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -323,7 +340,7 @@ def create( Default value is "application/json". :paramtype content_type: str :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -344,9 +361,10 @@ def create( :type resource_name: str :param annotation_properties: Properties that need to be specified to create an annotation of a Application Insights component. Is either a Annotation type or a IO[bytes] type. Required. - :type annotation_properties: ~azure.mgmt.applicationinsights.models.Annotation or IO[bytes] + :type annotation_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation or + IO[bytes] :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -360,7 +378,7 @@ def create( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) @@ -394,7 +412,10 @@ def create( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.AnnotationError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.AnnotationError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("[Annotation]", pipeline_response.http_response) @@ -433,7 +454,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -476,7 +497,7 @@ def get( component. Required. :type annotation_id: str :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -490,7 +511,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) _request = build_get_request( @@ -513,7 +534,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.AnnotationError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.AnnotationError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("[Annotation]", pipeline_response.http_response) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_api_keys_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_api_keys_operations.py similarity index 92% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_api_keys_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_api_keys_operations.py index 72fdc26967a2..0c8726da1043 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_api_keys_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_api_keys_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -31,7 +32,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -180,7 +182,7 @@ class APIKeysOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`api_keys` attribute. """ @@ -209,13 +211,13 @@ def list( :return: An iterator like instance of either ApplicationInsightsComponentAPIKey or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey] + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey] :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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentAPIKeyListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -240,7 +242,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -288,12 +301,12 @@ def create( :type resource_name: str :param api_key_properties: Properties that need to be specified to create an API key of a Application Insights component. Required. - :type api_key_properties: ~azure.mgmt.applicationinsights.models.APIKeyRequest + :type api_key_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.APIKeyRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey :raises ~azure.core.exceptions.HttpResponseError: """ @@ -321,7 +334,7 @@ def create( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey :raises ~azure.core.exceptions.HttpResponseError: """ @@ -342,9 +355,10 @@ def create( :type resource_name: str :param api_key_properties: Properties that need to be specified to create an API key of a Application Insights component. Is either a APIKeyRequest type or a IO[bytes] type. Required. - :type api_key_properties: ~azure.mgmt.applicationinsights.models.APIKeyRequest or IO[bytes] + :type api_key_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.APIKeyRequest or + IO[bytes] :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -358,7 +372,7 @@ def create( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) @@ -416,7 +430,7 @@ def delete( Required. :type key_id: str :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -430,7 +444,7 @@ def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) _request = build_delete_request( @@ -477,7 +491,7 @@ def get( Required. :type key_id: str :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -491,7 +505,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) _request = build_get_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_available_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_available_features_operations.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_available_features_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_available_features_operations.py index b923955fc4cb..e9dea086e100 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_available_features_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_available_features_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar from azure.core import PipelineClient from azure.core.exceptions import ( @@ -29,7 +29,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -72,7 +73,7 @@ class ComponentAvailableFeaturesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`component_available_features` attribute. """ @@ -99,7 +100,8 @@ def get( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: ApplicationInsightsComponentAvailableFeatures or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAvailableFeatures + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAvailableFeatures :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -113,7 +115,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentAvailableFeatures] = kwargs.pop("cls", None) _request = build_get_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_current_billing_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_current_billing_features_operations.py similarity index 92% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_current_billing_features_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_current_billing_features_operations.py index 7708e8ab7108..6cdbfe1e6562 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_current_billing_features_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_current_billing_features_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -30,7 +30,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -109,7 +110,7 @@ class ComponentCurrentBillingFeaturesOperations: # pylint: disable=name-too-lon **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`component_current_billing_features` attribute. """ @@ -136,7 +137,8 @@ def get( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -150,7 +152,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) _request = build_get_request( @@ -201,12 +203,13 @@ def update( :param billing_features_properties: Properties that need to be specified to update billing features for an Application Insights component. Required. :type billing_features_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures :raises ~azure.core.exceptions.HttpResponseError: """ @@ -234,7 +237,8 @@ def update( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures :raises ~azure.core.exceptions.HttpResponseError: """ @@ -257,9 +261,11 @@ def update( features for an Application Insights component. Is either a ApplicationInsightsComponentBillingFeatures type or a IO[bytes] type. Required. :type billing_features_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures + or IO[bytes] :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -273,7 +279,7 @@ def update( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_feature_capabilities_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_feature_capabilities_operations.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_feature_capabilities_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_feature_capabilities_operations.py index 7b9f0340a93c..1cbc86549d5f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_feature_capabilities_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_feature_capabilities_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar from azure.core import PipelineClient from azure.core.exceptions import ( @@ -29,7 +29,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -72,7 +73,7 @@ class ComponentFeatureCapabilitiesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`component_feature_capabilities` attribute. """ @@ -99,7 +100,8 @@ def get( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: ApplicationInsightsComponentFeatureCapabilities or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeatureCapabilities + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFeatureCapabilities :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -113,7 +115,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentFeatureCapabilities] = kwargs.pop("cls", None) _request = build_get_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_quota_status_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_quota_status_operations.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_quota_status_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_quota_status_operations.py index 4e5d74125430..fb2a3d1b9af9 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_quota_status_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_quota_status_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar from azure.core import PipelineClient from azure.core.exceptions import ( @@ -29,7 +29,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -72,7 +73,7 @@ class ComponentQuotaStatusOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`component_quota_status` attribute. """ @@ -99,7 +100,8 @@ def get( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: ApplicationInsightsComponentQuotaStatus or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentQuotaStatus + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentQuotaStatus :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -113,7 +115,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentQuotaStatus] = kwargs.pop("cls", None) _request = build_get_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_components_operations.py new file mode 100644 index 000000000000..692572a0bfae --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_components_operations.py @@ -0,0 +1,1061 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components") + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_get_request(resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_request( + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_purge_status_request( + resource_group_name: str, resource_name: str, purge_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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s + :attr:`components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of all Application Insights components within a subscription. + + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of Application Insights components within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ApplicationInsightsComponent: + """Returns an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: _models.ApplicationInsightsComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. + Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent or IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(insight_properties, (IOBase, bytes)): + _content = insight_properties + else: + _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: Union[_models.TagsResource, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Is either a + TagsResource type or a IO[bytes] type. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource or + IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(component_tags, (IOBase, bytes)): + _content = component_tags + else: + _json = self._serialize.body(component_tags, "TagsResource") + + _request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def purge( + self, + resource_group_name: str, + resource_name: str, + body: _models.ComponentPurgeBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def purge( + self, + resource_group_name: str, + resource_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def purge( + self, + resource_group_name: str, + resource_name: str, + body: Union[_models.ComponentPurgeBody, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBody or IO[bytes] + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ComponentPurgeBody") + + _request = build_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_purge_status( + self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any + ) -> _models.ComponentPurgeStatusResponse: + """Get status for an ongoing purge operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param purge_id: In a purge status request, this is the Id of the operation the status of which + is returned. Required. + :type purge_id: str + :return: ComponentPurgeStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) + + _request = build_get_purge_status_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + purge_id=purge_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_export_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_export_configurations_operations.py similarity index 93% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_export_configurations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_export_configurations_operations.py index 801039ccff89..ed56a4fc988d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_export_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_export_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -30,7 +30,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -216,7 +217,7 @@ class ExportConfigurationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`export_configurations` attribute. """ @@ -244,7 +245,7 @@ def list( :type resource_name: str :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) :rtype: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -258,7 +259,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) _request = build_list_request( @@ -311,13 +312,13 @@ def create( :param export_properties: Properties that need to be specified to create a Continuous Export configuration of a Application Insights component. Required. :type export_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) :rtype: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -346,7 +347,7 @@ def create( :paramtype content_type: str :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) :rtype: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -369,10 +370,11 @@ def create( configuration of a Application Insights component. Is either a ApplicationInsightsComponentExportRequest type or a IO[bytes] type. Required. :type export_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest or + IO[bytes] :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) :rtype: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -386,7 +388,7 @@ def create( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) @@ -446,7 +448,8 @@ def delete( Insights component. Required. :type export_id: str :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -460,7 +463,7 @@ def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) _request = build_delete_request( @@ -509,7 +512,8 @@ def get( Insights component. Required. :type export_id: str :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -523,7 +527,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) _request = build_get_request( @@ -581,12 +585,13 @@ def update( :param export_properties: Properties that need to be specified to update the Continuous Export configuration. Required. :type export_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -618,7 +623,8 @@ def update( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -645,9 +651,11 @@ def update( configuration. Is either a ApplicationInsightsComponentExportRequest type or a IO[bytes] type. Required. :type export_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest or + IO[bytes] :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :rtype: + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -661,7 +669,7 @@ def update( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_favorites_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_favorites_operations.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_favorites_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_favorites_operations.py index 3cdb09ff9ab3..c02ae6341e31 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_favorites_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_favorites_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -30,7 +30,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -227,7 +228,7 @@ class FavoritesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`favorites` attribute. """ @@ -262,11 +263,11 @@ def list( :type resource_name: str :param favorite_type: The type of favorite. Value can be either shared or user. Known values are: "shared" and "user". Default value is None. - :type favorite_type: str or ~azure.mgmt.applicationinsights.models.FavoriteType + :type favorite_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteType :param source_type: Source type of favorite to return. When left out, the source type defaults to 'other' (not present in this enum). Known values are: "retention", "notebook", "sessions", "events", "userflows", "funnel", "impact", and "segmentation". Default value is None. - :type source_type: str or ~azure.mgmt.applicationinsights.models.FavoriteSourceType + :type source_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteSourceType :param can_fetch_content: Flag indicating whether or not to return the full content for each applicable favorite. If false, only return summary content for favorites. Default value is None. @@ -274,7 +275,8 @@ def list( :param tags: Tags that must be present on each favorite returned. Default value is None. :type tags: list[str] :return: list of ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite] + :rtype: + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -288,7 +290,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.ApplicationInsightsComponentFavorite]] = kwargs.pop("cls", None) _request = build_list_request( @@ -338,7 +340,7 @@ def get( component. Required. :type favorite_id: str :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -352,7 +354,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) _request = build_get_request( @@ -408,12 +410,12 @@ def add( :param favorite_properties: Properties that need to be specified to create a new favorite and add it to an Application Insights component. Required. :type favorite_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ @@ -445,7 +447,7 @@ def add( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ @@ -472,9 +474,10 @@ def add( add it to an Application Insights component. Is either a ApplicationInsightsComponentFavorite type or a IO[bytes] type. Required. :type favorite_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite or + IO[bytes] :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -488,7 +491,7 @@ def add( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) @@ -556,12 +559,12 @@ def update( :param favorite_properties: Properties that need to be specified to update the existing favorite. Required. :type favorite_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ @@ -593,7 +596,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ @@ -619,9 +622,10 @@ def update( :param favorite_properties: Properties that need to be specified to update the existing favorite. Is either a ApplicationInsightsComponentFavorite type or a IO[bytes] type. Required. :type favorite_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite or + IO[bytes] :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -635,7 +639,7 @@ def update( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) @@ -708,7 +712,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_my_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_my_workbooks_operations.py new file mode 100644 index 000000000000..28bd6774b4ae --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_my_workbooks_operations.py @@ -0,0 +1,865 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks", + ) + 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["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + _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_subscription_request( + subscription_id: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks") + 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["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class MyWorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s + :attr:`my_workbooks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.MyWorkbook"]: + """Get all private workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either MyWorkbook or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MyWorkbooksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return 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.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.MyWorkbook"]: + """Get all private workbooks defined within a specified subscription and category. + + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either MyWorkbook or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MyWorkbooksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return 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.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.MyWorkbook: + """Get a single private workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Delete a private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.MyWorkbook, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.MyWorkbook, IO[bytes]], + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook or + IO[bytes] + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "MyWorkbook") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.MyWorkbook, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.MyWorkbook, IO[bytes]], + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook or + IO[bytes] + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "MyWorkbook") + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_operations.py similarity index 80% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_operations.py index 9239529aac90..0bfbb5beb9d2 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_operations.py @@ -6,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -29,7 +30,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -39,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", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +62,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`operations` attribute. """ @@ -80,13 +82,14 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: """Lists all of the available insights REST API operations. :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.Operation] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -108,7 +111,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -131,7 +145,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_proactive_detection_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_proactive_detection_configurations_operations.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_proactive_detection_configurations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_proactive_detection_configurations_operations.py index d654002879fa..d03a151d514d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_proactive_detection_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_proactive_detection_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -30,7 +30,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -146,7 +147,7 @@ class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-lo **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`proactive_detection_configurations` attribute. """ @@ -175,7 +176,7 @@ def list( :return: list of ApplicationInsightsComponentProactiveDetectionConfiguration or the result of cls(response) :rtype: - list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration] + list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration] :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -189,7 +190,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( "cls", None ) @@ -241,7 +242,7 @@ def get( :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of cls(response) :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -255,7 +256,7 @@ 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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) _request = build_get_request( @@ -313,14 +314,14 @@ def update( :param proactive_detection_properties: Properties that need to be specified to update the ProactiveDetection configuration. Required. :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of cls(response) :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -354,7 +355,7 @@ def update( :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of cls(response) :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -383,12 +384,12 @@ def update( ProactiveDetection configuration. Is either a ApplicationInsightsComponentProactiveDetectionConfiguration type or a IO[bytes] type. Required. :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration or IO[bytes] :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of cls(response) :rtype: - ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -402,7 +403,7 @@ def update( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_web_test_locations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_test_locations_operations.py similarity index 86% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_web_test_locations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_test_locations_operations.py index 184c88e1c580..1a7d803aefcb 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_web_test_locations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_test_locations_operations.py @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -30,7 +31,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -75,7 +77,7 @@ class WebTestLocationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`web_test_locations` attribute. """ @@ -104,13 +106,13 @@ def list( :return: An iterator like instance of either ApplicationInsightsComponentWebTestLocation or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentWebTestLocation] + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentWebTestLocation] :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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsWebTestLocationsListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -135,7 +137,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_tests_operations.py new file mode 100644 index 000000000000..4161ed4606c7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_tests_operations.py @@ -0,0 +1,889 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, web_test_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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "webTestName": _SERIALIZER.url("web_test_name", web_test_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_create_or_update_request( + resource_group_name: str, web_test_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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, web_test_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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, web_test_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", + ) + 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 + ), + "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests") + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_component_request( + component_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{componentName}/webtests", + ) + path_format_arguments = { + "componentName": _SERIALIZER.url("component_name", component_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class WebTestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s + :attr:`web_tests` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined within a specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: + """Get a specific Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: _models.WebTest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: Union[_models.WebTest, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. + Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest or + IO[bytes] + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(web_test_definition, (IOBase, bytes)): + _content = web_test_definition + else: + _json = self._serialize.body(web_test_definition, "WebTest") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Required. + :type web_test_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: Union[_models.TagsResource, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Is either a + TagsResource type or a IO[bytes] type. Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource or + IO[bytes] + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(web_test_tags, (IOBase, bytes)): + _content = web_test_tags + else: + _json = self._serialize.body(web_test_tags, "TagsResource") + + _request = build_update_tags_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, web_test_name: str, **kwargs: Any + ) -> None: + """Deletes an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights webtest resource. Required. + :type web_test_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.WebTest"]: + """Get all Application Insights web test alerts definitions within a subscription. + + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_component( + self, component_name: str, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined for the specified component. + + :param component_name: The name of the Application Insights component resource. Required. + :type component_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_component_request( + component_name=component_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_work_item_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_work_item_configurations_operations.py similarity index 93% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_work_item_configurations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_work_item_configurations_operations.py index 374255496c24..59196bb102c7 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_work_item_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_work_item_configurations_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -31,7 +32,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -244,7 +246,7 @@ class WorkItemConfigurationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s :attr:`work_item_configurations` attribute. """ @@ -273,13 +275,13 @@ def list( :return: An iterator like instance of either WorkItemConfiguration or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.WorkItemConfiguration] + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration] :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", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkItemConfigurationsListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -304,7 +306,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -327,7 +340,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkItemConfigurationError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkItemConfigurationError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -354,12 +370,12 @@ def create( :param work_item_configuration_properties: Properties that need to be specified to create a work item configuration of a Application Insights component. Required. :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -387,7 +403,7 @@ def create( Default value is "application/json". :paramtype content_type: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -410,9 +426,9 @@ def create( work item configuration of a Application Insights component. Is either a WorkItemCreateConfiguration type or a IO[bytes] type. Required. :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration or IO[bytes] :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -426,7 +442,7 @@ def create( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) @@ -479,7 +495,7 @@ def get_default(self, resource_group_name: str, resource_name: str, **kwargs: An :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -493,7 +509,7 @@ def get_default(self, resource_group_name: str, resource_name: str, **kwargs: An _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) _request = build_get_default_request( @@ -553,7 +569,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -596,7 +612,7 @@ def get_item( name of connector as defined in connector configuration. Required. :type work_item_config_id: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -610,7 +626,7 @@ def get_item( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) _request = build_get_item_request( @@ -666,12 +682,12 @@ def update_item( :param work_item_configuration_properties: Properties that need to be specified to update a work item configuration for this Application Insights component. Required. :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration + ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -703,7 +719,7 @@ def update_item( Default value is "application/json". :paramtype content_type: str :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ @@ -730,9 +746,9 @@ def update_item( work item configuration for this Application Insights component. Is either a WorkItemCreateConfiguration type or a IO[bytes] type. Required. :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration or IO[bytes] + ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration or IO[bytes] :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -746,7 +762,7 @@ def update_item( _headers = case_insensitive_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-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_workbooks_operations.py new file mode 100644 index 000000000000..95d6a5947b54 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_workbooks_operations.py @@ -0,0 +1,732 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks", + ) + 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["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class WorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s + :attr:`workbooks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either Workbook or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbooksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Workbook: + """Get a single workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Delete a workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.Workbook, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.Workbook, IO[bytes]], + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. Is + either a Workbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook or + IO[bytes] + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "Workbook") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.Workbook, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.Workbook, IO[bytes]], + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. Is + either a Workbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook or + IO[bytes] + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "Workbook") + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/py.typed similarity index 100% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/py.typed rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/py.typed diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_application_insights_management_client.py new file mode 100644 index 000000000000..bc889d4070c7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_application_insights_management_client.py @@ -0,0 +1,155 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import ( + ComponentCurrentPricingPlanOperations, + EASubscriptionListMigrationDateOperations, + EASubscriptionMigrateToNewPricingModelOperations, + EASubscriptionRollbackToLegacyPricingModelOperations, +) + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar ea_subscription_migrate_to_new_pricing_model: + EASubscriptionMigrateToNewPricingModelOperations operations + :vartype ea_subscription_migrate_to_new_pricing_model: + azure.mgmt.applicationinsights.v2017_10_01.operations.EASubscriptionMigrateToNewPricingModelOperations + :ivar ea_subscription_rollback_to_legacy_pricing_model: + EASubscriptionRollbackToLegacyPricingModelOperations operations + :vartype ea_subscription_rollback_to_legacy_pricing_model: + azure.mgmt.applicationinsights.v2017_10_01.operations.EASubscriptionRollbackToLegacyPricingModelOperations + :ivar ea_subscription_list_migration_date: EASubscriptionListMigrationDateOperations operations + :vartype ea_subscription_list_migration_date: + azure.mgmt.applicationinsights.v2017_10_01.operations.EASubscriptionListMigrationDateOperations + :ivar component_current_pricing_plan: ComponentCurrentPricingPlanOperations operations + :vartype component_current_pricing_plan: + azure.mgmt.applicationinsights.v2017_10_01.operations.ComponentCurrentPricingPlanOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2017-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.ea_subscription_migrate_to_new_pricing_model = EASubscriptionMigrateToNewPricingModelOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ea_subscription_rollback_to_legacy_pricing_model = EASubscriptionRollbackToLegacyPricingModelOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ea_subscription_list_migration_date = EASubscriptionListMigrationDateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.component_current_pricing_plan = ComponentCurrentPricingPlanOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_configuration.py new file mode 100644 index 000000000000..0b65cb4dae46 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2017-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, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2017-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..feec4d8b20da --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_application_insights_management_client.py @@ -0,0 +1,159 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import ( + ComponentCurrentPricingPlanOperations, + EASubscriptionListMigrationDateOperations, + EASubscriptionMigrateToNewPricingModelOperations, + EASubscriptionRollbackToLegacyPricingModelOperations, +) + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar ea_subscription_migrate_to_new_pricing_model: + EASubscriptionMigrateToNewPricingModelOperations operations + :vartype ea_subscription_migrate_to_new_pricing_model: + azure.mgmt.applicationinsights.v2017_10_01.aio.operations.EASubscriptionMigrateToNewPricingModelOperations + :ivar ea_subscription_rollback_to_legacy_pricing_model: + EASubscriptionRollbackToLegacyPricingModelOperations operations + :vartype ea_subscription_rollback_to_legacy_pricing_model: + azure.mgmt.applicationinsights.v2017_10_01.aio.operations.EASubscriptionRollbackToLegacyPricingModelOperations + :ivar ea_subscription_list_migration_date: EASubscriptionListMigrationDateOperations operations + :vartype ea_subscription_list_migration_date: + azure.mgmt.applicationinsights.v2017_10_01.aio.operations.EASubscriptionListMigrationDateOperations + :ivar component_current_pricing_plan: ComponentCurrentPricingPlanOperations operations + :vartype component_current_pricing_plan: + azure.mgmt.applicationinsights.v2017_10_01.aio.operations.ComponentCurrentPricingPlanOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2017-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.ea_subscription_migrate_to_new_pricing_model = EASubscriptionMigrateToNewPricingModelOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ea_subscription_rollback_to_legacy_pricing_model = EASubscriptionRollbackToLegacyPricingModelOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.ea_subscription_list_migration_date = EASubscriptionListMigrationDateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.component_current_pricing_plan = ComponentCurrentPricingPlanOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_configuration.py new file mode 100644 index 000000000000..efc78aabc021 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2017-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, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2017-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/__init__.py new file mode 100644 index 000000000000..e591e53f1a74 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/__init__.py @@ -0,0 +1,32 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._ea_subscription_migrate_to_new_pricing_model_operations import EASubscriptionMigrateToNewPricingModelOperations # type: ignore +from ._ea_subscription_rollback_to_legacy_pricing_model_operations import EASubscriptionRollbackToLegacyPricingModelOperations # type: ignore +from ._ea_subscription_list_migration_date_operations import EASubscriptionListMigrationDateOperations # type: ignore +from ._component_current_pricing_plan_operations import ComponentCurrentPricingPlanOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EASubscriptionMigrateToNewPricingModelOperations", + "EASubscriptionRollbackToLegacyPricingModelOperations", + "EASubscriptionListMigrationDateOperations", + "ComponentCurrentPricingPlanOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_component_current_pricing_plan_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_component_current_pricing_plan_operations.py new file mode 100644 index 000000000000..0dc35cc3da64 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_component_current_pricing_plan_operations.py @@ -0,0 +1,395 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._component_current_pricing_plan_operations import ( + build_create_and_update_request, + build_get_request, + build_update_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class ComponentCurrentPricingPlanOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2017_10_01.aio.ApplicationInsightsManagementClient`'s + :attr:`component_current_pricing_plan` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Returns the current pricing plan setting for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_and_update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: _models.ApplicationInsightsComponentPricingPlan, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Replace current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Required. + :type pricing_plan_properties: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_and_update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Replace current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Required. + :type pricing_plan_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_and_update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: Union[_models.ApplicationInsightsComponentPricingPlan, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Replace current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Is either a ApplicationInsightsComponentPricingPlan + type or a IO[bytes] type. Required. + :type pricing_plan_properties: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan or + IO[bytes] + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pricing_plan_properties, (IOBase, bytes)): + _content = pricing_plan_properties + else: + _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") + + _request = build_create_and_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: _models.ApplicationInsightsComponentPricingPlan, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Update current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Required. + :type pricing_plan_properties: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Update current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Required. + :type pricing_plan_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: Union[_models.ApplicationInsightsComponentPricingPlan, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Update current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Is either a ApplicationInsightsComponentPricingPlan + type or a IO[bytes] type. Required. + :type pricing_plan_properties: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan or + IO[bytes] + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pricing_plan_properties, (IOBase, bytes)): + _content = pricing_plan_properties + else: + _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_list_migration_date_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_list_migration_date_operations.py new file mode 100644 index 000000000000..ba8933edab20 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_list_migration_date_operations.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._ea_subscription_list_migration_date_operations import build_post_request +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class EASubscriptionListMigrationDateOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2017_10_01.aio.ApplicationInsightsManagementClient`'s + :attr:`ea_subscription_list_migration_date` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def post(self, **kwargs: Any) -> _models.EASubscriptionMigrationDate: + """list date to migrate to new pricing model. + + :return: EASubscriptionMigrationDate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2017_10_01.models.EASubscriptionMigrationDate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EASubscriptionMigrationDate] = kwargs.pop("cls", None) + + _request = build_post_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EASubscriptionMigrationDate", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py new file mode 100644 index 000000000000..7af58ce20ee5 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._ea_subscription_migrate_to_new_pricing_model_operations import build_post_request +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class EASubscriptionMigrateToNewPricingModelOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2017_10_01.aio.ApplicationInsightsManagementClient`'s + :attr:`ea_subscription_migrate_to_new_pricing_model` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def post(self, **kwargs: Any) -> None: + """Enterprise Agreement Customer opted to use new pricing model. + + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_post_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py new file mode 100644 index 000000000000..5bd246ff6c75 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._ea_subscription_rollback_to_legacy_pricing_model_operations import build_post_request +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class EASubscriptionRollbackToLegacyPricingModelOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2017_10_01.aio.ApplicationInsightsManagementClient`'s + :attr:`ea_subscription_rollback_to_legacy_pricing_model` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def post(self, **kwargs: Any) -> None: + """Enterprise Agreement Customer roll back to use legacy pricing model. + + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_post_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/__init__.py new file mode 100644 index 000000000000..1cea28d5c33a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ApplicationInsightsComponentPricingPlan, + CloudErrorBody, + EASubscriptionMigrationDate, + Resource, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsComponentPricingPlan", + "CloudErrorBody", + "EASubscriptionMigrationDate", + "Resource", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_models_py3.py new file mode 100644 index 000000000000..82beb21d7a79 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_models_py3.py @@ -0,0 +1,219 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Optional, TYPE_CHECKING + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models + + +class Resource(_serialization.Model): + """An Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :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: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + + +class ApplicationInsightsComponentPricingPlan(Resource): + """An Application Insights component pricing plan. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar plan_type: Pricing Plan Type Name. + :vartype plan_type: str + :ivar cap: Daily data volume cap in GB. + :vartype cap: float + :ivar reset_hour: Daily data volume cap UTC reset hour. + :vartype reset_hour: int + :ivar warning_threshold: Reserved, not used for now. + :vartype warning_threshold: int + :ivar stop_send_notification_when_hit_threshold: Reserved, not used for now. + :vartype stop_send_notification_when_hit_threshold: bool + :ivar stop_send_notification_when_hit_cap: Do not send a notification email when the daily data + volume cap is met. + :vartype stop_send_notification_when_hit_cap: bool + :ivar max_history_cap: Maximum daily data volume cap that the user can set for this component. + :vartype max_history_cap: float + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "reset_hour": {"readonly": True}, + "max_history_cap": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "plan_type": {"key": "properties.planType", "type": "str"}, + "cap": {"key": "properties.cap", "type": "float"}, + "reset_hour": {"key": "properties.resetHour", "type": "int"}, + "warning_threshold": {"key": "properties.warningThreshold", "type": "int"}, + "stop_send_notification_when_hit_threshold": { + "key": "properties.stopSendNotificationWhenHitThreshold", + "type": "bool", + }, + "stop_send_notification_when_hit_cap": {"key": "properties.stopSendNotificationWhenHitCap", "type": "bool"}, + "max_history_cap": {"key": "properties.maxHistoryCap", "type": "float"}, + } + + def __init__( + self, + *, + plan_type: Optional[str] = None, + cap: Optional[float] = None, + warning_threshold: Optional[int] = None, + stop_send_notification_when_hit_threshold: Optional[bool] = None, + stop_send_notification_when_hit_cap: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword plan_type: Pricing Plan Type Name. + :paramtype plan_type: str + :keyword cap: Daily data volume cap in GB. + :paramtype cap: float + :keyword warning_threshold: Reserved, not used for now. + :paramtype warning_threshold: int + :keyword stop_send_notification_when_hit_threshold: Reserved, not used for now. + :paramtype stop_send_notification_when_hit_threshold: bool + :keyword stop_send_notification_when_hit_cap: Do not send a notification email when the daily + data volume cap is met. + :paramtype stop_send_notification_when_hit_cap: bool + """ + super().__init__(**kwargs) + self.plan_type = plan_type + self.cap = cap + self.reset_hour: Optional[int] = None + self.warning_threshold = warning_threshold + self.stop_send_notification_when_hit_threshold = stop_send_notification_when_hit_threshold + self.stop_send_notification_when_hit_cap = stop_send_notification_when_hit_cap + self.max_history_cap: Optional[float] = None + + +class CloudErrorBody(_serialization.Model): + """An error response from the Batch service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.applicationinsights.v2017_10_01.models.CloudErrorBody] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[CloudErrorBody]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[list["_models.CloudErrorBody"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.applicationinsights.v2017_10_01.models.CloudErrorBody] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class EASubscriptionMigrationDate(_serialization.Model): + """Subscription migrate date information properties. + + :ivar is_grand_fatherable_subscription: Is subscription in the grand fatherable subscription + list. + :vartype is_grand_fatherable_subscription: bool + :ivar opted_in_date: Time to start using new pricing model. + :vartype opted_in_date: ~datetime.datetime + """ + + _attribute_map = { + "is_grand_fatherable_subscription": {"key": "isGrandFatherableSubscription", "type": "bool"}, + "opted_in_date": {"key": "optedInDate", "type": "iso-8601"}, + } + + def __init__( + self, + *, + is_grand_fatherable_subscription: Optional[bool] = None, + opted_in_date: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword is_grand_fatherable_subscription: Is subscription in the grand fatherable subscription + list. + :paramtype is_grand_fatherable_subscription: bool + :keyword opted_in_date: Time to start using new pricing model. + :paramtype opted_in_date: ~datetime.datetime + """ + super().__init__(**kwargs) + self.is_grand_fatherable_subscription = is_grand_fatherable_subscription + self.opted_in_date = opted_in_date diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/__init__.py new file mode 100644 index 000000000000..e591e53f1a74 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/__init__.py @@ -0,0 +1,32 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._ea_subscription_migrate_to_new_pricing_model_operations import EASubscriptionMigrateToNewPricingModelOperations # type: ignore +from ._ea_subscription_rollback_to_legacy_pricing_model_operations import EASubscriptionRollbackToLegacyPricingModelOperations # type: ignore +from ._ea_subscription_list_migration_date_operations import EASubscriptionListMigrationDateOperations # type: ignore +from ._component_current_pricing_plan_operations import ComponentCurrentPricingPlanOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EASubscriptionMigrateToNewPricingModelOperations", + "EASubscriptionRollbackToLegacyPricingModelOperations", + "EASubscriptionListMigrationDateOperations", + "ComponentCurrentPricingPlanOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_component_current_pricing_plan_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_component_current_pricing_plan_operations.py new file mode 100644 index 000000000000..ba25ce8cb3a2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_component_current_pricing_plan_operations.py @@ -0,0 +1,497 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_group_name: str, 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", "2017-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/pricingPlans/current", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_and_update_request( + resource_group_name: str, 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", "2017-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/pricingPlans/current", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, 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", "2017-10-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/pricingPlans/current", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class ComponentCurrentPricingPlanOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2017_10_01.ApplicationInsightsManagementClient`'s + :attr:`component_current_pricing_plan` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Returns the current pricing plan setting for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_and_update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: _models.ApplicationInsightsComponentPricingPlan, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Replace current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Required. + :type pricing_plan_properties: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_and_update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Replace current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Required. + :type pricing_plan_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_and_update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: Union[_models.ApplicationInsightsComponentPricingPlan, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Replace current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Is either a ApplicationInsightsComponentPricingPlan + type or a IO[bytes] type. Required. + :type pricing_plan_properties: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan or + IO[bytes] + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pricing_plan_properties, (IOBase, bytes)): + _content = pricing_plan_properties + else: + _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") + + _request = build_create_and_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: _models.ApplicationInsightsComponentPricingPlan, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Update current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Required. + :type pricing_plan_properties: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Update current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Required. + :type pricing_plan_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + pricing_plan_properties: Union[_models.ApplicationInsightsComponentPricingPlan, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentPricingPlan: + """Update current pricing plan for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param pricing_plan_properties: Properties that need to be specified to update current pricing + plan for an Application Insights component. Is either a ApplicationInsightsComponentPricingPlan + type or a IO[bytes] type. Required. + :type pricing_plan_properties: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan or + IO[bytes] + :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(pricing_plan_properties, (IOBase, bytes)): + _content = pricing_plan_properties + else: + _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_list_migration_date_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_list_migration_date_operations.py new file mode 100644 index 000000000000..67bf3fabd5e1 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_list_migration_date_operations.py @@ -0,0 +1,128 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/listMigrationdate") + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class EASubscriptionListMigrationDateOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2017_10_01.ApplicationInsightsManagementClient`'s + :attr:`ea_subscription_list_migration_date` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def post(self, **kwargs: Any) -> _models.EASubscriptionMigrationDate: + """list date to migrate to new pricing model. + + :return: EASubscriptionMigrationDate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2017_10_01.models.EASubscriptionMigrationDate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EASubscriptionMigrationDate] = kwargs.pop("cls", None) + + _request = build_post_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("EASubscriptionMigrationDate", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py new file mode 100644 index 000000000000..34b39123f17b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py @@ -0,0 +1,126 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/migrateToNewPricingModel" + ) + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class EASubscriptionMigrateToNewPricingModelOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2017_10_01.ApplicationInsightsManagementClient`'s + :attr:`ea_subscription_migrate_to_new_pricing_model` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Enterprise Agreement Customer opted to use new pricing model. + + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_post_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py new file mode 100644 index 000000000000..90a2147d5ed4 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py @@ -0,0 +1,126 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/rollbackToLegacyPricingModel" + ) + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class EASubscriptionRollbackToLegacyPricingModelOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2017_10_01.ApplicationInsightsManagementClient`'s + :attr:`ea_subscription_rollback_to_legacy_pricing_model` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Enterprise Agreement Customer roll back to use legacy pricing model. + + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_post_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_application_insights_management_client.py new file mode 100644 index 000000000000..039787063899 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_application_insights_management_client.py @@ -0,0 +1,141 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import ComponentsOperations, Operations, ProactiveDetectionConfigurationsOperations, WebTestsOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar proactive_detection_configurations: ProactiveDetectionConfigurationsOperations operations + :vartype proactive_detection_configurations: + azure.mgmt.applicationinsights.v2018_05_01_preview.operations.ProactiveDetectionConfigurationsOperations + :ivar components: ComponentsOperations operations + :vartype components: + azure.mgmt.applicationinsights.v2018_05_01_preview.operations.ComponentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.applicationinsights.v2018_05_01_preview.operations.Operations + :ivar web_tests: WebTestsOperations operations + :vartype web_tests: + azure.mgmt.applicationinsights.v2018_05_01_preview.operations.WebTestsOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2018-05-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_configuration.py new file mode 100644 index 000000000000..70941a117d43 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2018-05-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, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2018-05-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..025f8ab85af2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_application_insights_management_client.py @@ -0,0 +1,146 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import ComponentsOperations, Operations, ProactiveDetectionConfigurationsOperations, WebTestsOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar proactive_detection_configurations: ProactiveDetectionConfigurationsOperations operations + :vartype proactive_detection_configurations: + azure.mgmt.applicationinsights.v2018_05_01_preview.aio.operations.ProactiveDetectionConfigurationsOperations + :ivar components: ComponentsOperations operations + :vartype components: + azure.mgmt.applicationinsights.v2018_05_01_preview.aio.operations.ComponentsOperations + :ivar operations: Operations operations + :vartype operations: + azure.mgmt.applicationinsights.v2018_05_01_preview.aio.operations.Operations + :ivar web_tests: WebTestsOperations operations + :vartype web_tests: + azure.mgmt.applicationinsights.v2018_05_01_preview.aio.operations.WebTestsOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2018-05-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..9767f3e61f45 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2018-05-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, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2018-05-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..173ad1d7a923 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._proactive_detection_configurations_operations import ProactiveDetectionConfigurationsOperations # type: ignore +from ._components_operations import ComponentsOperations # type: ignore +from ._operations import Operations # type: ignore +from ._web_tests_operations import WebTestsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ProactiveDetectionConfigurationsOperations", + "ComponentsOperations", + "Operations", + "WebTestsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_components_operations.py new file mode 100644 index 000000000000..ea53adcc3d74 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_components_operations.py @@ -0,0 +1,817 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._components_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_purge_status_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_purge_request, + build_update_tags_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class ComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.aio.ApplicationInsightsManagementClient`'s + :attr:`components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of all Application Insights components within a subscription. + + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of Application Insights components within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Deletes an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Returns an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: _models.ApplicationInsightsComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. + Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent or + IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(insight_properties, (IOBase, bytes)): + _content = insight_properties + else: + _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: Union[_models.TagsResource, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Is either a + TagsResource type or a IO[bytes] type. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource + or IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(component_tags, (IOBase, bytes)): + _content = component_tags + else: + _json = self._serialize.body(component_tags, "TagsResource") + + _request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: _models.ComponentPurgeBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: Union[_models.ComponentPurgeBody, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBody or + IO[bytes] + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ComponentPurgeBody") + + _request = build_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_purge_status( + self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any + ) -> _models.ComponentPurgeStatusResponse: + """Get status for an ongoing purge operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param purge_id: In a purge status request, this is the Id of the operation the status of which + is returned. Required. + :type purge_id: str + :return: ComponentPurgeStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) + + _request = build_get_purge_status_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + purge_id=purge_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..adacfeac2efe --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_operations.py @@ -0,0 +1,133 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import build_list_request +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.aio.ApplicationInsightsManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: + """List available operations. + + List the available operations supported by the Microsoft.EventGrid resource provider. + + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationsListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_proactive_detection_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_proactive_detection_configurations_operations.py new file mode 100644 index 000000000000..d0dd8d6421d2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_proactive_detection_configurations_operations.py @@ -0,0 +1,350 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._proactive_detection_configurations_operations import ( + build_get_request, + build_list_request, + build_update_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.aio.ApplicationInsightsManagementClient`'s + :attr:`proactive_detection_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]: + """Gets a list of ProactiveDetection configurations of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: list of ApplicationInsightsComponentProactiveDetectionConfiguration or the result of + cls(response) + :rtype: + list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( + "cls", None + ) + + _request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "[ApplicationInsightsComponentProactiveDetectionConfiguration]", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, configuration_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Get the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of + cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + configuration_id=configuration_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: _models.ApplicationInsightsComponentProactiveDetectionConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Required. + :type proactive_detection_properties: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of + cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Required. + :type proactive_detection_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of + cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: Union[ + _models.ApplicationInsightsComponentProactiveDetectionConfiguration, IO[bytes] + ], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Is either a + ApplicationInsightsComponentProactiveDetectionConfiguration type or a IO[bytes] type. Required. + :type proactive_detection_properties: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + or IO[bytes] + :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of + cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(proactive_detection_properties, (IOBase, bytes)): + _content = proactive_detection_properties + else: + _json = self._serialize.body( + proactive_detection_properties, "ApplicationInsightsComponentProactiveDetectionConfiguration" + ) + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + configuration_id=configuration_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_web_tests_operations.py new file mode 100644 index 000000000000..75701d9e3edd --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_web_tests_operations.py @@ -0,0 +1,676 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._web_tests_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_component_request, + build_list_by_resource_group_request, + build_list_request, + build_update_tags_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class WebTestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.aio.ApplicationInsightsManagementClient`'s + :attr:`web_tests` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined within a specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: + """Get a specific Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: _models.WebTest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: Union[_models.WebTest, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. + Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + or IO[bytes] + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(web_test_definition, (IOBase, bytes)): + _content = web_test_definition + else: + _json = self._serialize.body(web_test_definition, "WebTest") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Required. + :type web_test_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: Union[_models.TagsResource, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Is either a + TagsResource type or a IO[bytes] type. Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource or + IO[bytes] + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(web_test_tags, (IOBase, bytes)): + _content = web_test_tags + else: + _json = self._serialize.body(web_test_tags, "TagsResource") + + _request = build_update_tags_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> None: + """Deletes an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: + """Get all Application Insights web test alerts definitions within a subscription. + + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_component( + self, component_name: str, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined for the specified component. + + :param component_name: The name of the Application Insights component resource. Required. + :type component_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_component_request( + component_name=component_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/__init__.py new file mode 100644 index 000000000000..e2752ee95e38 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/__init__.py @@ -0,0 +1,90 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ApplicationInsightsComponent, + ApplicationInsightsComponentListResult, + ApplicationInsightsComponentProactiveDetectionConfiguration, + ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions, + ComponentPurgeBody, + ComponentPurgeBodyFilters, + ComponentPurgeResponse, + ComponentPurgeStatusResponse, + ComponentsResource, + HeaderField, + Operation, + OperationInfo, + OperationsListResult, + PrivateLinkScopedResource, + TagsResource, + WebTest, + WebTestGeolocation, + WebTestListResult, + WebTestPropertiesConfiguration, + WebTestPropertiesRequest, + WebTestPropertiesValidationRules, + WebTestPropertiesValidationRulesContentValidation, + WebtestsResource, +) + +from ._application_insights_management_client_enums import ( # type: ignore + ApplicationType, + FlowType, + IngestionMode, + PublicNetworkAccessType, + PurgeState, + RequestSource, + WebTestKind, + WebTestKindEnum, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsComponent", + "ApplicationInsightsComponentListResult", + "ApplicationInsightsComponentProactiveDetectionConfiguration", + "ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions", + "ComponentPurgeBody", + "ComponentPurgeBodyFilters", + "ComponentPurgeResponse", + "ComponentPurgeStatusResponse", + "ComponentsResource", + "HeaderField", + "Operation", + "OperationInfo", + "OperationsListResult", + "PrivateLinkScopedResource", + "TagsResource", + "WebTest", + "WebTestGeolocation", + "WebTestListResult", + "WebTestPropertiesConfiguration", + "WebTestPropertiesRequest", + "WebTestPropertiesValidationRules", + "WebTestPropertiesValidationRulesContentValidation", + "WebtestsResource", + "ApplicationType", + "FlowType", + "IngestionMode", + "PublicNetworkAccessType", + "PurgeState", + "RequestSource", + "WebTestKind", + "WebTestKindEnum", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_application_insights_management_client_enums.py new file mode 100644 index 000000000000..7209e1a69e55 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_application_insights_management_client_enums.py @@ -0,0 +1,76 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 ApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of application being monitored.""" + + WEB = "web" + OTHER = "other" + + +class FlowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Used by the Application Insights system to determine what kind of flow this component was + created by. This is to be set to 'Bluefield' when creating/updating a component via the REST + API. + """ + + BLUEFIELD = "Bluefield" + + +class IngestionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the flow of the ingestion.""" + + APPLICATION_INSIGHTS = "ApplicationInsights" + APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS = "ApplicationInsightsWithDiagnosticSettings" + LOG_ANALYTICS = "LogAnalytics" + + +class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The network access type for operating on the Application Insights Component. By default it is + Enabled. + """ + + ENABLED = "Enabled" + """Enables connectivity to Application Insights through public DNS.""" + DISABLED = "Disabled" + """Disables public connectivity to Application Insights through public DNS.""" + + +class PurgeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the operation represented by the requested Id.""" + + PENDING = "pending" + COMPLETED = "completed" + + +class RequestSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes what tool created this Application Insights component. Customers using this API + should set this to the default 'rest'. + """ + + REST = "rest" + + +class WebTestKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of WebTest that this web test watches. Choices are ping and multistep.""" + + PING = "ping" + MULTISTEP = "multistep" + + +class WebTestKindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of web test this is, valid choices are ping, multistep, basic, and standard.""" + + PING = "ping" + MULTISTEP = "multistep" + BASIC = "basic" + STANDARD = "standard" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..de17e05eca7b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_models_py3.py @@ -0,0 +1,1302 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from collections.abc import MutableMapping +import datetime +from typing import Any, Optional, TYPE_CHECKING, Union + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models +JSON = MutableMapping[str, Any] + + +class ComponentsResource(_serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.tags = tags + + +class ApplicationInsightsComponent(ComponentsResource): + """An Application Insights component definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind of application that this component refers to, used to customize UI. This + value is a freeform string, values should typically be one of the following: web, ios, other, + store, java, phone. Required. + :vartype kind: str + :ivar application_id: The unique ID of your application. This field mirrors the 'Name' field + and cannot be changed. + :vartype application_id: str + :ivar app_id: Application Insights Unique ID for your Application. + :vartype app_id: str + :ivar application_type: Type of application being monitored. Known values are: "web" and + "other". + :vartype application_type: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationType + :ivar flow_type: Used by the Application Insights system to determine what kind of flow this + component was created by. This is to be set to 'Bluefield' when creating/updating a component + via the REST API. "Bluefield" + :vartype flow_type: str or ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.FlowType + :ivar request_source: Describes what tool created this Application Insights component. + Customers using this API should set this to the default 'rest'. "rest" + :vartype request_source: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.RequestSource + :ivar instrumentation_key: Application Insights Instrumentation key. A read-only value that + applications can use to identify the destination for all telemetry sent to Azure Application + Insights. This value will be supplied upon construction of each new Application Insights + component. + :vartype instrumentation_key: str + :ivar creation_date: Creation Date for the Application Insights component, in ISO 8601 format. + :vartype creation_date: ~datetime.datetime + :ivar tenant_id: Azure Tenant Id. + :vartype tenant_id: str + :ivar hockey_app_id: The unique application ID created when a new application is added to + HockeyApp, used for communications with HockeyApp. + :vartype hockey_app_id: str + :ivar hockey_app_token: Token used to authenticate communications with between Application + Insights and HockeyApp. + :vartype hockey_app_token: str + :ivar provisioning_state: Current state of this component: whether or not is has been + provisioned within the resource group it is defined. Users cannot change this value but are + able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + :vartype provisioning_state: str + :ivar sampling_percentage: Percentage of the data produced by the application being monitored + that is being sampled for Application Insights telemetry. + :vartype sampling_percentage: float + :ivar connection_string: Application Insights component connection string. + :vartype connection_string: str + :ivar retention_in_days: Retention period in days. + :vartype retention_in_days: int + :ivar disable_ip_masking: Disable IP masking. + :vartype disable_ip_masking: bool + :ivar immediate_purge_data_on30_days: Purge data immediately after 30 days. + :vartype immediate_purge_data_on30_days: bool + :ivar private_link_scoped_resources: List of linked private link scope resources. + :vartype private_link_scoped_resources: + list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PrivateLinkScopedResource] + :ivar public_network_access_for_ingestion: The network access type for accessing Application + Insights ingestion. Known values are: "Enabled" and "Disabled". + :vartype public_network_access_for_ingestion: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PublicNetworkAccessType + :ivar public_network_access_for_query: The network access type for accessing Application + Insights query. Known values are: "Enabled" and "Disabled". + :vartype public_network_access_for_query: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PublicNetworkAccessType + :ivar ingestion_mode: Indicates the flow of the ingestion. Known values are: + "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". + :vartype ingestion_mode: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.IngestionMode + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "kind": {"required": True}, + "application_id": {"readonly": True}, + "app_id": {"readonly": True}, + "instrumentation_key": {"readonly": True}, + "creation_date": {"readonly": True}, + "tenant_id": {"readonly": True}, + "hockey_app_token": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "connection_string": {"readonly": True}, + "private_link_scoped_resources": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kind": {"key": "kind", "type": "str"}, + "application_id": {"key": "properties.ApplicationId", "type": "str"}, + "app_id": {"key": "properties.AppId", "type": "str"}, + "application_type": {"key": "properties.Application_Type", "type": "str"}, + "flow_type": {"key": "properties.Flow_Type", "type": "str"}, + "request_source": {"key": "properties.Request_Source", "type": "str"}, + "instrumentation_key": {"key": "properties.InstrumentationKey", "type": "str"}, + "creation_date": {"key": "properties.CreationDate", "type": "iso-8601"}, + "tenant_id": {"key": "properties.TenantId", "type": "str"}, + "hockey_app_id": {"key": "properties.HockeyAppId", "type": "str"}, + "hockey_app_token": {"key": "properties.HockeyAppToken", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "sampling_percentage": {"key": "properties.SamplingPercentage", "type": "float"}, + "connection_string": {"key": "properties.ConnectionString", "type": "str"}, + "retention_in_days": {"key": "properties.RetentionInDays", "type": "int"}, + "disable_ip_masking": {"key": "properties.DisableIpMasking", "type": "bool"}, + "immediate_purge_data_on30_days": {"key": "properties.ImmediatePurgeDataOn30Days", "type": "bool"}, + "private_link_scoped_resources": { + "key": "properties.PrivateLinkScopedResources", + "type": "[PrivateLinkScopedResource]", + }, + "public_network_access_for_ingestion": {"key": "properties.publicNetworkAccessForIngestion", "type": "str"}, + "public_network_access_for_query": {"key": "properties.publicNetworkAccessForQuery", "type": "str"}, + "ingestion_mode": {"key": "properties.IngestionMode", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + kind: str, + tags: Optional[dict[str, str]] = None, + application_type: Union[str, "_models.ApplicationType"] = "web", + flow_type: Union[str, "_models.FlowType"] = "Bluefield", + request_source: Union[str, "_models.RequestSource"] = "rest", + hockey_app_id: Optional[str] = None, + sampling_percentage: Optional[float] = None, + retention_in_days: int = 90, + disable_ip_masking: Optional[bool] = None, + immediate_purge_data_on30_days: Optional[bool] = None, + public_network_access_for_ingestion: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", + public_network_access_for_query: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", + ingestion_mode: Union[str, "_models.IngestionMode"] = "ApplicationInsights", + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword kind: The kind of application that this component refers to, used to customize UI. + This value is a freeform string, values should typically be one of the following: web, ios, + other, store, java, phone. Required. + :paramtype kind: str + :keyword application_type: Type of application being monitored. Known values are: "web" and + "other". + :paramtype application_type: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationType + :keyword flow_type: Used by the Application Insights system to determine what kind of flow this + component was created by. This is to be set to 'Bluefield' when creating/updating a component + via the REST API. "Bluefield" + :paramtype flow_type: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.FlowType + :keyword request_source: Describes what tool created this Application Insights component. + Customers using this API should set this to the default 'rest'. "rest" + :paramtype request_source: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.RequestSource + :keyword hockey_app_id: The unique application ID created when a new application is added to + HockeyApp, used for communications with HockeyApp. + :paramtype hockey_app_id: str + :keyword sampling_percentage: Percentage of the data produced by the application being + monitored that is being sampled for Application Insights telemetry. + :paramtype sampling_percentage: float + :keyword retention_in_days: Retention period in days. + :paramtype retention_in_days: int + :keyword disable_ip_masking: Disable IP masking. + :paramtype disable_ip_masking: bool + :keyword immediate_purge_data_on30_days: Purge data immediately after 30 days. + :paramtype immediate_purge_data_on30_days: bool + :keyword public_network_access_for_ingestion: The network access type for accessing Application + Insights ingestion. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access_for_ingestion: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PublicNetworkAccessType + :keyword public_network_access_for_query: The network access type for accessing Application + Insights query. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access_for_query: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PublicNetworkAccessType + :keyword ingestion_mode: Indicates the flow of the ingestion. Known values are: + "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". + :paramtype ingestion_mode: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.IngestionMode + """ + super().__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.application_id: Optional[str] = None + self.app_id: Optional[str] = None + self.application_type = application_type + self.flow_type = flow_type + self.request_source = request_source + self.instrumentation_key: Optional[str] = None + self.creation_date: Optional[datetime.datetime] = None + self.tenant_id: Optional[str] = None + self.hockey_app_id = hockey_app_id + self.hockey_app_token: Optional[str] = None + self.provisioning_state: Optional[str] = None + self.sampling_percentage = sampling_percentage + self.connection_string: Optional[str] = None + self.retention_in_days = retention_in_days + self.disable_ip_masking = disable_ip_masking + self.immediate_purge_data_on30_days = immediate_purge_data_on30_days + self.private_link_scoped_resources: Optional[list["_models.PrivateLinkScopedResource"]] = None + self.public_network_access_for_ingestion = public_network_access_for_ingestion + self.public_network_access_for_query = public_network_access_for_query + self.ingestion_mode = ingestion_mode + + +class ApplicationInsightsComponentListResult(_serialization.Model): + """Describes the list of Application Insights Resources. + + All required parameters must be populated in order to send to server. + + :ivar value: List of Application Insights component definitions. Required. + :vartype value: + list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] + :ivar next_link: The URI to get the next set of Application Insights component definitions if + too many components where returned in the result set. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationInsightsComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: list["_models.ApplicationInsightsComponent"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of Application Insights component definitions. Required. + :paramtype value: + list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] + :keyword next_link: The URI to get the next set of Application Insights component definitions + if too many components where returned in the result set. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApplicationInsightsComponentProactiveDetectionConfiguration( + _serialization.Model +): # pylint: disable=name-too-long + """A ProactiveDetection configuration definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar name_properties_name: The rule name. + :vartype name_properties_name: str + :ivar enabled: A flag that indicates whether this rule is enabled by the user. + :vartype enabled: bool + :ivar send_emails_to_subscription_owners: A flag that indicated whether notifications on this + rule should be sent to subscription owners. + :vartype send_emails_to_subscription_owners: bool + :ivar custom_emails: Custom email addresses for this rule notifications. + :vartype custom_emails: list[str] + :ivar last_updated_time: The last time this rule was updated. + :vartype last_updated_time: str + :ivar rule_definitions: Static definitions of the ProactiveDetection configuration rule (same + values for all components). + :vartype rule_definitions: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions + """ + + _validation = { + "id": {"readonly": True}, + "type": {"readonly": True}, + "name_properties_name": {"readonly": True}, + "last_updated_time": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "name_properties_name": {"key": "properties.Name", "type": "str"}, + "enabled": {"key": "properties.Enabled", "type": "bool"}, + "send_emails_to_subscription_owners": {"key": "properties.SendEmailsToSubscriptionOwners", "type": "bool"}, + "custom_emails": {"key": "properties.CustomEmails", "type": "[str]"}, + "last_updated_time": {"key": "properties.LastUpdatedTime", "type": "str"}, + "rule_definitions": { + "key": "properties.RuleDefinitions", + "type": "ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions", + }, + } + + def __init__( + self, + *, + name: Optional[str] = None, + location: Optional[str] = None, + enabled: Optional[bool] = None, + send_emails_to_subscription_owners: Optional[bool] = None, + custom_emails: Optional[list[str]] = None, + rule_definitions: Optional[ + "_models.ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions" + ] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Azure resource name. + :paramtype name: str + :keyword location: Resource location. + :paramtype location: str + :keyword enabled: A flag that indicates whether this rule is enabled by the user. + :paramtype enabled: bool + :keyword send_emails_to_subscription_owners: A flag that indicated whether notifications on + this rule should be sent to subscription owners. + :paramtype send_emails_to_subscription_owners: bool + :keyword custom_emails: Custom email addresses for this rule notifications. + :paramtype custom_emails: list[str] + :keyword rule_definitions: Static definitions of the ProactiveDetection configuration rule + (same values for all components). + :paramtype rule_definitions: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name = name + self.type: Optional[str] = None + self.location = location + self.name_properties_name: Optional[str] = None + self.enabled = enabled + self.send_emails_to_subscription_owners = send_emails_to_subscription_owners + self.custom_emails = custom_emails + self.last_updated_time: Optional[str] = None + self.rule_definitions = rule_definitions + + +class ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions( + _serialization.Model +): # pylint: disable=name-too-long + """Static definitions of the ProactiveDetection configuration rule (same values for all + components). + + :ivar name: The rule name. + :vartype name: str + :ivar display_name: The rule name as it is displayed in UI. + :vartype display_name: str + :ivar description: The rule description. + :vartype description: str + :ivar help_url: URL which displays additional info about the proactive detection rule. + :vartype help_url: str + :ivar is_hidden: A flag indicating whether the rule is hidden (from the UI). + :vartype is_hidden: bool + :ivar is_enabled_by_default: A flag indicating whether the rule is enabled by default. + :vartype is_enabled_by_default: bool + :ivar is_in_preview: A flag indicating whether the rule is in preview. + :vartype is_in_preview: bool + :ivar supports_email_notifications: A flag indicating whether email notifications are supported + for detections for this rule. + :vartype supports_email_notifications: bool + """ + + _attribute_map = { + "name": {"key": "Name", "type": "str"}, + "display_name": {"key": "DisplayName", "type": "str"}, + "description": {"key": "Description", "type": "str"}, + "help_url": {"key": "HelpUrl", "type": "str"}, + "is_hidden": {"key": "IsHidden", "type": "bool"}, + "is_enabled_by_default": {"key": "IsEnabledByDefault", "type": "bool"}, + "is_in_preview": {"key": "IsInPreview", "type": "bool"}, + "supports_email_notifications": {"key": "SupportsEmailNotifications", "type": "bool"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + help_url: Optional[str] = None, + is_hidden: Optional[bool] = None, + is_enabled_by_default: Optional[bool] = None, + is_in_preview: Optional[bool] = None, + supports_email_notifications: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The rule name. + :paramtype name: str + :keyword display_name: The rule name as it is displayed in UI. + :paramtype display_name: str + :keyword description: The rule description. + :paramtype description: str + :keyword help_url: URL which displays additional info about the proactive detection rule. + :paramtype help_url: str + :keyword is_hidden: A flag indicating whether the rule is hidden (from the UI). + :paramtype is_hidden: bool + :keyword is_enabled_by_default: A flag indicating whether the rule is enabled by default. + :paramtype is_enabled_by_default: bool + :keyword is_in_preview: A flag indicating whether the rule is in preview. + :paramtype is_in_preview: bool + :keyword supports_email_notifications: A flag indicating whether email notifications are + supported for detections for this rule. + :paramtype supports_email_notifications: bool + """ + super().__init__(**kwargs) + self.name = name + self.display_name = display_name + self.description = description + self.help_url = help_url + self.is_hidden = is_hidden + self.is_enabled_by_default = is_enabled_by_default + self.is_in_preview = is_in_preview + self.supports_email_notifications = supports_email_notifications + + +class ComponentPurgeBody(_serialization.Model): + """Describes the body of a purge request for an App Insights component. + + All required parameters must be populated in order to send to server. + + :ivar table: Table from which to purge data. Required. + :vartype table: str + :ivar filters: The set of columns and filters (queries) to run over them to purge the resulting + data. Required. + :vartype filters: + list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBodyFilters] + """ + + _validation = { + "table": {"required": True}, + "filters": {"required": True}, + } + + _attribute_map = { + "table": {"key": "table", "type": "str"}, + "filters": {"key": "filters", "type": "[ComponentPurgeBodyFilters]"}, + } + + def __init__(self, *, table: str, filters: list["_models.ComponentPurgeBodyFilters"], **kwargs: Any) -> None: + """ + :keyword table: Table from which to purge data. Required. + :paramtype table: str + :keyword filters: The set of columns and filters (queries) to run over them to purge the + resulting data. Required. + :paramtype filters: + list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBodyFilters] + """ + super().__init__(**kwargs) + self.table = table + self.filters = filters + + +class ComponentPurgeBodyFilters(_serialization.Model): + """User-defined filters to return data which will be purged from the table. + + :ivar column: The column of the table over which the given query should run. + :vartype column: str + :ivar operator: A query operator to evaluate over the provided column and value(s). Supported + operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would + in a KQL query. + :vartype operator: str + :ivar value: the value for the operator to function over. This can be a number (e.g., > 100), a + string (timestamp >= '2017-09-01') or array of values. + :vartype value: any + :ivar key: When filtering over custom dimensions, this key will be used as the name of the + custom dimension. + :vartype key: str + """ + + _attribute_map = { + "column": {"key": "column", "type": "str"}, + "operator": {"key": "operator", "type": "str"}, + "value": {"key": "value", "type": "object"}, + "key": {"key": "key", "type": "str"}, + } + + def __init__( + self, + *, + column: Optional[str] = None, + operator: Optional[str] = None, + value: Optional[Any] = None, + key: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword column: The column of the table over which the given query should run. + :paramtype column: str + :keyword operator: A query operator to evaluate over the provided column and value(s). + Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as + they would in a KQL query. + :paramtype operator: str + :keyword value: the value for the operator to function over. This can be a number (e.g., > + 100), a string (timestamp >= '2017-09-01') or array of values. + :paramtype value: any + :keyword key: When filtering over custom dimensions, this key will be used as the name of the + custom dimension. + :paramtype key: str + """ + super().__init__(**kwargs) + self.column = column + self.operator = operator + self.value = value + self.key = key + + +class ComponentPurgeResponse(_serialization.Model): + """Response containing operationId for a specific purge action. + + All required parameters must be populated in order to send to server. + + :ivar operation_id: Id to use when querying for status for a particular purge operation. + Required. + :vartype operation_id: str + """ + + _validation = { + "operation_id": {"required": True}, + } + + _attribute_map = { + "operation_id": {"key": "operationId", "type": "str"}, + } + + def __init__(self, *, operation_id: str, **kwargs: Any) -> None: + """ + :keyword operation_id: Id to use when querying for status for a particular purge operation. + Required. + :paramtype operation_id: str + """ + super().__init__(**kwargs) + self.operation_id = operation_id + + +class ComponentPurgeStatusResponse(_serialization.Model): + """Response containing status for a specific purge operation. + + All required parameters must be populated in order to send to server. + + :ivar status: Status of the operation represented by the requested Id. Required. Known values + are: "pending" and "completed". + :vartype status: str or ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PurgeState + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, *, status: Union[str, "_models.PurgeState"], **kwargs: Any) -> None: + """ + :keyword status: Status of the operation represented by the requested Id. Required. Known + values are: "pending" and "completed". + :paramtype status: str or ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PurgeState + """ + super().__init__(**kwargs) + self.status = status + + +class HeaderField(_serialization.Model): + """A header to add to the WebTest. + + :ivar header_field_name: The name of the header. + :vartype header_field_name: str + :ivar header_field_value: The value of the header. + :vartype header_field_value: str + """ + + _attribute_map = { + "header_field_name": {"key": "key", "type": "str"}, + "header_field_value": {"key": "value", "type": "str"}, + } + + def __init__( + self, *, header_field_name: Optional[str] = None, header_field_value: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword header_field_name: The name of the header. + :paramtype header_field_name: str + :keyword header_field_value: The value of the header. + :paramtype header_field_value: str + """ + super().__init__(**kwargs) + self.header_field_name = header_field_name + self.header_field_value = header_field_value + + +class Operation(_serialization.Model): + """Represents an operation returned by the GetOperations request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Display name of the operation. + :vartype display: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.OperationInfo + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: JSON + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationInfo"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.OperationInfo"] = None, + origin: Optional[str] = None, + properties: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Display name of the operation. + :paramtype display: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.OperationInfo + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: JSON + """ + super().__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.properties = properties + + +class OperationInfo(_serialization.Model): + """Information about an operation. + + :ivar provider: Name of the provider. + :vartype provider: str + :ivar resource: Name of the resource type. + :vartype resource: str + :ivar operation: Name of the operation. + :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: Name of the provider. + :paramtype provider: str + :keyword resource: Name of the resource type. + :paramtype resource: str + :keyword operation: Name of the operation. + :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 OperationsListResult(_serialization.Model): + """Result of the List Operations operation. + + :ivar value: A collection of operations. + :vartype value: list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[list["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A collection of operations. + :paramtype value: list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.Operation] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkScopedResource(_serialization.Model): + """The private link scope resource reference. + + :ivar resource_id: The full resource Id of the private link scope resource. + :vartype resource_id: str + :ivar scope_id: The private link scope unique Identifier. + :vartype scope_id: str + """ + + _attribute_map = { + "resource_id": {"key": "ResourceId", "type": "str"}, + "scope_id": {"key": "ScopeId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, scope_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The full resource Id of the private link scope resource. + :paramtype resource_id: str + :keyword scope_id: The private link scope unique Identifier. + :paramtype scope_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.scope_id = scope_id + + +class TagsResource(_serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on a + WebTest instance. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class WebtestsResource(_serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.tags = tags + + +class WebTest(WebtestsResource): + """An Application Insights WebTest definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind of WebTest that this web test watches. Choices are ping and multistep. + Known values are: "ping" and "multistep". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestKind + :ivar synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as the + Name field. + :vartype synthetic_monitor_id: str + :ivar web_test_name: User defined name if this WebTest. + :vartype web_test_name: str + :ivar description: User defined description for this WebTest. + :vartype description: str + :ivar enabled: Is the test actively being monitored. + :vartype enabled: bool + :ivar frequency: Interval in seconds between test runs for this WebTest. Default value is 300. + :vartype frequency: int + :ivar timeout: Seconds until this WebTest will timeout and fail. Default value is 30. + :vartype timeout: int + :ivar web_test_kind: The kind of web test this is, valid choices are ping, multistep, basic, + and standard. Known values are: "ping", "multistep", "basic", and "standard". + :vartype web_test_kind: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestKindEnum + :ivar retry_enabled: Allow for retries should this WebTest fail. + :vartype retry_enabled: bool + :ivar locations: A list of where to physically run the tests from to give global coverage for + accessibility of your application. + :vartype locations: + list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestGeolocation] + :ivar configuration: An XML configuration specification for a WebTest. + :vartype configuration: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesConfiguration + :ivar provisioning_state: Current state of this component, whether or not is has been + provisioned within the resource group it is defined. Users cannot change this value but are + able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + :vartype provisioning_state: str + :ivar request: The collection of request properties. + :vartype request: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesRequest + :ivar validation_rules: The collection of validation rule properties. + :vartype validation_rules: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesValidationRules + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kind": {"key": "kind", "type": "str"}, + "synthetic_monitor_id": {"key": "properties.SyntheticMonitorId", "type": "str"}, + "web_test_name": {"key": "properties.Name", "type": "str"}, + "description": {"key": "properties.Description", "type": "str"}, + "enabled": {"key": "properties.Enabled", "type": "bool"}, + "frequency": {"key": "properties.Frequency", "type": "int"}, + "timeout": {"key": "properties.Timeout", "type": "int"}, + "web_test_kind": {"key": "properties.Kind", "type": "str"}, + "retry_enabled": {"key": "properties.RetryEnabled", "type": "bool"}, + "locations": {"key": "properties.Locations", "type": "[WebTestGeolocation]"}, + "configuration": {"key": "properties.Configuration", "type": "WebTestPropertiesConfiguration"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "request": {"key": "properties.Request", "type": "WebTestPropertiesRequest"}, + "validation_rules": {"key": "properties.ValidationRules", "type": "WebTestPropertiesValidationRules"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + kind: Union[str, "_models.WebTestKind"] = "ping", + synthetic_monitor_id: Optional[str] = None, + web_test_name: Optional[str] = None, + description: Optional[str] = None, + enabled: Optional[bool] = None, + frequency: int = 300, + timeout: int = 30, + web_test_kind: Union[str, "_models.WebTestKindEnum"] = "ping", + retry_enabled: Optional[bool] = None, + locations: Optional[list["_models.WebTestGeolocation"]] = None, + configuration: Optional["_models.WebTestPropertiesConfiguration"] = None, + request: Optional["_models.WebTestPropertiesRequest"] = None, + validation_rules: Optional["_models.WebTestPropertiesValidationRules"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword kind: The kind of WebTest that this web test watches. Choices are ping and multistep. + Known values are: "ping" and "multistep". + :paramtype kind: str or ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestKind + :keyword synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as + the Name field. + :paramtype synthetic_monitor_id: str + :keyword web_test_name: User defined name if this WebTest. + :paramtype web_test_name: str + :keyword description: User defined description for this WebTest. + :paramtype description: str + :keyword enabled: Is the test actively being monitored. + :paramtype enabled: bool + :keyword frequency: Interval in seconds between test runs for this WebTest. Default value is + 300. + :paramtype frequency: int + :keyword timeout: Seconds until this WebTest will timeout and fail. Default value is 30. + :paramtype timeout: int + :keyword web_test_kind: The kind of web test this is, valid choices are ping, multistep, basic, + and standard. Known values are: "ping", "multistep", "basic", and "standard". + :paramtype web_test_kind: str or + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestKindEnum + :keyword retry_enabled: Allow for retries should this WebTest fail. + :paramtype retry_enabled: bool + :keyword locations: A list of where to physically run the tests from to give global coverage + for accessibility of your application. + :paramtype locations: + list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestGeolocation] + :keyword configuration: An XML configuration specification for a WebTest. + :paramtype configuration: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesConfiguration + :keyword request: The collection of request properties. + :paramtype request: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesRequest + :keyword validation_rules: The collection of validation rule properties. + :paramtype validation_rules: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesValidationRules + """ + super().__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.synthetic_monitor_id = synthetic_monitor_id + self.web_test_name = web_test_name + self.description = description + self.enabled = enabled + self.frequency = frequency + self.timeout = timeout + self.web_test_kind = web_test_kind + self.retry_enabled = retry_enabled + self.locations = locations + self.configuration = configuration + self.provisioning_state: Optional[str] = None + self.request = request + self.validation_rules = validation_rules + + +class WebTestGeolocation(_serialization.Model): + """Geo-physical location to run a WebTest from. You must specify one or more locations for the + test to run from. + + :ivar location: Location ID for the WebTest to run from. + :vartype location: str + """ + + _attribute_map = { + "location": {"key": "Id", "type": "str"}, + } + + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword location: Location ID for the WebTest to run from. + :paramtype location: str + """ + super().__init__(**kwargs) + self.location = location + + +class WebTestListResult(_serialization.Model): + """A list of 0 or more Application Insights WebTest definitions. + + All required parameters must be populated in order to send to server. + + :ivar value: Set of Application Insights WebTest definitions. Required. + :vartype value: list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] + :ivar next_link: The link to get the next part of the returned list of WebTest, should the + return set be too large for a single request. May be null. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[WebTest]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: list["_models.WebTest"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: Set of Application Insights WebTest definitions. Required. + :paramtype value: list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] + :keyword next_link: The link to get the next part of the returned list of WebTest, should the + return set be too large for a single request. May be null. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class WebTestPropertiesConfiguration(_serialization.Model): + """An XML configuration specification for a WebTest. + + :ivar web_test: The XML specification of a WebTest to run against an application. + :vartype web_test: str + """ + + _attribute_map = { + "web_test": {"key": "WebTest", "type": "str"}, + } + + def __init__(self, *, web_test: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword web_test: The XML specification of a WebTest to run against an application. + :paramtype web_test: str + """ + super().__init__(**kwargs) + self.web_test = web_test + + +class WebTestPropertiesRequest(_serialization.Model): + """The collection of request properties. + + :ivar request_url: Url location to test. + :vartype request_url: str + :ivar headers: List of headers and their values to add to the WebTest call. + :vartype headers: list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.HeaderField] + :ivar http_verb: Http verb to use for this web test. + :vartype http_verb: str + :ivar request_body: Base64 encoded string body to send with this web test. + :vartype request_body: str + :ivar parse_dependent_requests: Parse Dependent request for this WebTest. + :vartype parse_dependent_requests: bool + :ivar follow_redirects: Follow redirects for this web test. + :vartype follow_redirects: bool + """ + + _attribute_map = { + "request_url": {"key": "RequestUrl", "type": "str"}, + "headers": {"key": "Headers", "type": "[HeaderField]"}, + "http_verb": {"key": "HttpVerb", "type": "str"}, + "request_body": {"key": "RequestBody", "type": "str"}, + "parse_dependent_requests": {"key": "ParseDependentRequests", "type": "bool"}, + "follow_redirects": {"key": "FollowRedirects", "type": "bool"}, + } + + def __init__( + self, + *, + request_url: Optional[str] = None, + headers: Optional[list["_models.HeaderField"]] = None, + http_verb: Optional[str] = None, + request_body: Optional[str] = None, + parse_dependent_requests: Optional[bool] = None, + follow_redirects: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword request_url: Url location to test. + :paramtype request_url: str + :keyword headers: List of headers and their values to add to the WebTest call. + :paramtype headers: + list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.HeaderField] + :keyword http_verb: Http verb to use for this web test. + :paramtype http_verb: str + :keyword request_body: Base64 encoded string body to send with this web test. + :paramtype request_body: str + :keyword parse_dependent_requests: Parse Dependent request for this WebTest. + :paramtype parse_dependent_requests: bool + :keyword follow_redirects: Follow redirects for this web test. + :paramtype follow_redirects: bool + """ + super().__init__(**kwargs) + self.request_url = request_url + self.headers = headers + self.http_verb = http_verb + self.request_body = request_body + self.parse_dependent_requests = parse_dependent_requests + self.follow_redirects = follow_redirects + + +class WebTestPropertiesValidationRules(_serialization.Model): + """The collection of validation rule properties. + + :ivar content_validation: The collection of content validation properties. + :vartype content_validation: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesValidationRulesContentValidation + :ivar ssl_check: Checks to see if the SSL cert is still valid. + :vartype ssl_check: bool + :ivar ssl_cert_remaining_lifetime_check: A number of days to check still remain before the the + existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. + :vartype ssl_cert_remaining_lifetime_check: int + :ivar expected_http_status_code: Validate that the WebTest returns the http status code + provided. + :vartype expected_http_status_code: int + :ivar ignore_https_status_code: When set, validation will ignore the status code. + :vartype ignore_https_status_code: bool + """ + + _attribute_map = { + "content_validation": {"key": "ContentValidation", "type": "WebTestPropertiesValidationRulesContentValidation"}, + "ssl_check": {"key": "SSLCheck", "type": "bool"}, + "ssl_cert_remaining_lifetime_check": {"key": "SSLCertRemainingLifetimeCheck", "type": "int"}, + "expected_http_status_code": {"key": "ExpectedHttpStatusCode", "type": "int"}, + "ignore_https_status_code": {"key": "IgnoreHttpsStatusCode", "type": "bool"}, + } + + def __init__( + self, + *, + content_validation: Optional["_models.WebTestPropertiesValidationRulesContentValidation"] = None, + ssl_check: Optional[bool] = None, + ssl_cert_remaining_lifetime_check: Optional[int] = None, + expected_http_status_code: Optional[int] = None, + ignore_https_status_code: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword content_validation: The collection of content validation properties. + :paramtype content_validation: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesValidationRulesContentValidation + :keyword ssl_check: Checks to see if the SSL cert is still valid. + :paramtype ssl_check: bool + :keyword ssl_cert_remaining_lifetime_check: A number of days to check still remain before the + the existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. + :paramtype ssl_cert_remaining_lifetime_check: int + :keyword expected_http_status_code: Validate that the WebTest returns the http status code + provided. + :paramtype expected_http_status_code: int + :keyword ignore_https_status_code: When set, validation will ignore the status code. + :paramtype ignore_https_status_code: bool + """ + super().__init__(**kwargs) + self.content_validation = content_validation + self.ssl_check = ssl_check + self.ssl_cert_remaining_lifetime_check = ssl_cert_remaining_lifetime_check + self.expected_http_status_code = expected_http_status_code + self.ignore_https_status_code = ignore_https_status_code + + +class WebTestPropertiesValidationRulesContentValidation(_serialization.Model): # pylint: disable=name-too-long + """The collection of content validation properties. + + :ivar content_match: Content to look for in the return of the WebTest. Must not be null or + empty. + :vartype content_match: str + :ivar ignore_case: When set, this value makes the ContentMatch validation case insensitive. + :vartype ignore_case: bool + :ivar pass_if_text_found: When true, validation will pass if there is a match for the + ContentMatch string. If false, validation will fail if there is a match. + :vartype pass_if_text_found: bool + """ + + _attribute_map = { + "content_match": {"key": "ContentMatch", "type": "str"}, + "ignore_case": {"key": "IgnoreCase", "type": "bool"}, + "pass_if_text_found": {"key": "PassIfTextFound", "type": "bool"}, + } + + def __init__( + self, + *, + content_match: Optional[str] = None, + ignore_case: Optional[bool] = None, + pass_if_text_found: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword content_match: Content to look for in the return of the WebTest. Must not be null or + empty. + :paramtype content_match: str + :keyword ignore_case: When set, this value makes the ContentMatch validation case insensitive. + :paramtype ignore_case: bool + :keyword pass_if_text_found: When true, validation will pass if there is a match for the + ContentMatch string. If false, validation will fail if there is a match. + :paramtype pass_if_text_found: bool + """ + super().__init__(**kwargs) + self.content_match = content_match + self.ignore_case = ignore_case + self.pass_if_text_found = pass_if_text_found diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/__init__.py new file mode 100644 index 000000000000..173ad1d7a923 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._proactive_detection_configurations_operations import ProactiveDetectionConfigurationsOperations # type: ignore +from ._components_operations import ComponentsOperations # type: ignore +from ._operations import Operations # type: ignore +from ._web_tests_operations import WebTestsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ProactiveDetectionConfigurationsOperations", + "ComponentsOperations", + "Operations", + "WebTestsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_components_operations.py new file mode 100644 index 000000000000..940cd05084f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_components_operations.py @@ -0,0 +1,1063 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components") + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_get_request(resource_group_name: str, 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", "2018-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, 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", "2018-05-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, 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", "2018-05-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_request( + resource_group_name: str, 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", "2018-05-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_purge_status_request( + resource_group_name: str, resource_name: str, purge_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", "2018-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.ApplicationInsightsManagementClient`'s + :attr:`components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of all Application Insights components within a subscription. + + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of Application Insights components within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ApplicationInsightsComponent: + """Returns an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: _models.ApplicationInsightsComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. + Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent or + IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(insight_properties, (IOBase, bytes)): + _content = insight_properties + else: + _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: Union[_models.TagsResource, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Is either a + TagsResource type or a IO[bytes] type. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource + or IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(component_tags, (IOBase, bytes)): + _content = component_tags + else: + _json = self._serialize.body(component_tags, "TagsResource") + + _request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def purge( + self, + resource_group_name: str, + resource_name: str, + body: _models.ComponentPurgeBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def purge( + self, + resource_group_name: str, + resource_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def purge( + self, + resource_group_name: str, + resource_name: str, + body: Union[_models.ComponentPurgeBody, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBody or + IO[bytes] + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ComponentPurgeBody") + + _request = build_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_purge_status( + self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any + ) -> _models.ComponentPurgeStatusResponse: + """Get status for an ongoing purge operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param purge_id: In a purge status request, this is the Id of the operation the status of which + is returned. Required. + :type purge_id: str + :return: ComponentPurgeStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) + + _request = build_get_purge_status_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + purge_id=purge_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_operations.py new file mode 100644 index 000000000000..3fd5a0a3722a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_operations.py @@ -0,0 +1,154 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_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-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/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.applicationinsights.v2018_05_01_preview.ApplicationInsightsManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """List available operations. + + List the available operations supported by the Microsoft.EventGrid resource provider. + + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationsListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_proactive_detection_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_proactive_detection_configurations_operations.py new file mode 100644 index 000000000000..2937dd2d35d4 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_proactive_detection_configurations_operations.py @@ -0,0 +1,452 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, 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", "2018-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, resource_name: str, configuration_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", "2018-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, resource_name: str, configuration_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", "2018-05-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.ApplicationInsightsManagementClient`'s + :attr:`proactive_detection_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]: + """Gets a list of ProactiveDetection configurations of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: list of ApplicationInsightsComponentProactiveDetectionConfiguration or the result of + cls(response) + :rtype: + list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( + "cls", None + ) + + _request = build_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "[ApplicationInsightsComponentProactiveDetectionConfiguration]", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, configuration_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Get the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of + cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + configuration_id=configuration_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: _models.ApplicationInsightsComponentProactiveDetectionConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Required. + :type proactive_detection_properties: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of + cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Required. + :type proactive_detection_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of + cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: Union[ + _models.ApplicationInsightsComponentProactiveDetectionConfiguration, IO[bytes] + ], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Is either a + ApplicationInsightsComponentProactiveDetectionConfiguration type or a IO[bytes] type. Required. + :type proactive_detection_properties: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + or IO[bytes] + :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of + cls(response) + :rtype: + ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(proactive_detection_properties, (IOBase, bytes)): + _content = proactive_detection_properties + else: + _json = self._serialize.body( + proactive_detection_properties, "ApplicationInsightsComponentProactiveDetectionConfiguration" + ) + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + configuration_id=configuration_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize( + "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_web_tests_operations.py new file mode 100644 index 000000000000..5730b3b21aa2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_web_tests_operations.py @@ -0,0 +1,889 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, web_test_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", "2018-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "webTestName": _SERIALIZER.url("web_test_name", web_test_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_create_or_update_request( + resource_group_name: str, web_test_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", "2018-05-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, web_test_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", "2018-05-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, web_test_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", + ) + 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 + ), + "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests") + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_component_request( + component_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{componentName}/webtests", + ) + path_format_arguments = { + "componentName": _SERIALIZER.url("component_name", component_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class WebTestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.ApplicationInsightsManagementClient`'s + :attr:`web_tests` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined within a specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: + """Get a specific Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: _models.WebTest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: Union[_models.WebTest, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. + Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + or IO[bytes] + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(web_test_definition, (IOBase, bytes)): + _content = web_test_definition + else: + _json = self._serialize.body(web_test_definition, "WebTest") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Required. + :type web_test_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: Union[_models.TagsResource, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to set into the web test instance. Is either a + TagsResource type or a IO[bytes] type. Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource or + IO[bytes] + :return: WebTest or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(web_test_tags, (IOBase, bytes)): + _content = web_test_tags + else: + _json = self._serialize.body(web_test_tags, "TagsResource") + + _request = build_update_tags_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WebTest", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, web_test_name: str, **kwargs: Any + ) -> None: + """Deletes an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.WebTest"]: + """Get all Application Insights web test alerts definitions within a subscription. + + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_component( + self, component_name: str, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined for the specified component. + + :param component_name: The name of the Application Insights component resource. Required. + :type component_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either WebTest or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_component_request( + component_name=component_name, + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WebTestListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_application_insights_management_client.py new file mode 100644 index 000000000000..1e21ccedcbda --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_application_insights_management_client.py @@ -0,0 +1,131 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import Operations, WorkbooksOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar workbooks: WorkbooksOperations operations + :vartype workbooks: + azure.mgmt.applicationinsights.v2018_06_17_preview.operations.WorkbooksOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.applicationinsights.v2018_06_17_preview.operations.Operations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2018-06-17-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_configuration.py new file mode 100644 index 000000000000..cd8c17b2f848 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2018-06-17-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2018-06-17-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..4f4cdd71c32e --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_application_insights_management_client.py @@ -0,0 +1,136 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import Operations, WorkbooksOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar workbooks: WorkbooksOperations operations + :vartype workbooks: + azure.mgmt.applicationinsights.v2018_06_17_preview.aio.operations.WorkbooksOperations + :ivar operations: Operations operations + :vartype operations: + azure.mgmt.applicationinsights.v2018_06_17_preview.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: The ID of the target subscription. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2018-06-17-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_configuration.py new file mode 100644 index 000000000000..1e97c9556149 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2018-06-17-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2018-06-17-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..aed9fd104c66 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._workbooks_operations import WorkbooksOperations # type: ignore +from ._operations import Operations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbooksOperations", + "Operations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_deleted_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_operations.py similarity index 69% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_deleted_workbooks_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_operations.py index 16b19481b2b3..f7c4506bbd97 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_deleted_workbooks_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_operations.py @@ -6,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, List, Optional, TypeVar, Union +from typing import Any, Callable, Optional, TypeVar +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -26,21 +27,22 @@ from ... import models as _models from ..._utils.serialization import Deserializer, Serializer -from ...operations._deleted_workbooks_operations import build_list_by_subscription_request +from ...operations._operations import build_list_request from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list -class DeletedWorkbooksOperations: +class Operations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s - :attr:`deleted_workbooks` attribute. + :class:`~azure.mgmt.applicationinsights.v2018_06_17_preview.aio.ApplicationInsightsManagementClient`'s + :attr:`operations` attribute. """ models = _models @@ -55,29 +57,19 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_subscription( - self, - category: Optional[Union[str, _models.CategoryType]] = None, - tags: Optional[List[str]] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.DeletedWorkbook"]: - """Get all recently deleted Workbooks in a specified subscription. - - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Default value is None. - :type category: str or ~azure.mgmt.applicationinsights.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :return: An iterator like instance of either DeletedWorkbook or the result of cls(response) + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: + """Lists all of the available insights REST API operations. + + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.DeletedWorkbook] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[_models.DeletedWorkbooksListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -90,10 +82,7 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - category=category, - tags=tags, + _request = build_list_request( api_version=api_version, headers=_headers, params=_params, @@ -101,13 +90,24 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeletedWorkbooksListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -124,7 +124,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DeletedWorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_workbooks_operations.py new file mode 100644 index 000000000000..85fda2eac8d8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_workbooks_operations.py @@ -0,0 +1,585 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._workbooks_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_update_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class WorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2018_06_17_preview.aio.ApplicationInsightsManagementClient`'s + :attr:`workbooks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + category: Union[str, _models.CategoryType], + source_id: str, + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.CategoryType + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either Workbook or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + source_id=source_id, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbooksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Workbook: + """Get a single workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Delete a workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_properties: _models.Workbook, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_properties: Union[_models.Workbook, IO[bytes]], + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_properties: Properties that need to be specified to create a new workbook. Is + either a Workbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + or IO[bytes] + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "Workbook") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.WorkbookUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.WorkbookUpdateParameters or + IO[bytes] + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_update_parameters else None + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if workbook_update_parameters else None + _json = None + _content = None + if isinstance(workbook_update_parameters, (IOBase, bytes)): + _content = workbook_update_parameters + else: + if workbook_update_parameters is not None: + _json = self._serialize.body(workbook_update_parameters, "WorkbookUpdateParameters") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/__init__.py new file mode 100644 index 000000000000..fdcf4a98ff35 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/__init__.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ErrorFieldContract, + ErrorResponse, + Operation, + OperationDisplay, + OperationListResult, + Resource, + Workbook, + WorkbookError, + WorkbookUpdateParameters, + WorkbooksListResult, +) + +from ._application_insights_management_client_enums import ( # type: ignore + CategoryType, + SharedTypeKind, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ErrorFieldContract", + "ErrorResponse", + "Operation", + "OperationDisplay", + "OperationListResult", + "Resource", + "Workbook", + "WorkbookError", + "WorkbookUpdateParameters", + "WorkbooksListResult", + "CategoryType", + "SharedTypeKind", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_application_insights_management_client_enums.py new file mode 100644 index 000000000000..c1110cd17a40 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_application_insights_management_client_enums.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CategoryType.""" + + WORKBOOK = "workbook" + TSG = "TSG" + PERFORMANCE = "performance" + RETENTION = "retention" + + +class SharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of workbook. Choices are user and shared.""" + + USER = "user" + SHARED = "shared" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_models_py3.py new file mode 100644 index 000000000000..f2ff79ebaa75 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_models_py3.py @@ -0,0 +1,484 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, Union + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models + + +class ErrorFieldContract(_serialization.Model): + """Error Field contract. + + :ivar code: Property level error code. + :vartype code: str + :ivar message: Human-readable representation of property-level error. + :vartype message: str + :ivar target: Property name. + :vartype target: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword code: Property level error code. + :paramtype code: str + :keyword message: Human-readable representation of property-level error. + :paramtype message: str + :keyword target: Property name. + :paramtype target: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + + +class ErrorResponse(_serialization.Model): + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message indicating why the operation failed. + :paramtype message: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + + +class Operation(_serialization.Model): + """CDN REST API operation. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.applicationinsights.v2018_06_17_preview.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: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(_serialization.Model): + """The object that represents the operation. + + :ivar provider: Service provider: Microsoft.Cdn. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + _attribute_map = { + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword provider: Service provider: Microsoft.Cdn. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed: Profile, endpoint, etc. + :paramtype resource: str + :keyword operation: Operation type: Read, write, delete, etc. + :paramtype operation: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + + +class OperationListResult(_serialization.Model): + """Result of the request to list CDN operations. It contains a list of operations and a URL link + to get the next set of results. + + :ivar value: List of CDN operations supported by the CDN resource provider. + :vartype value: list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[list["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of CDN operations supported by the CDN resource provider. + :paramtype value: list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Operation] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Resource(_serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. This is GUID value. The display name should be assigned within + properties field. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + location: str, + kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, + tags: Optional[dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :paramtype kind: str or + ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.kind = kind + self.location = location + self.tags = tags + + +class Workbook(Resource): + """An Application Insights workbook definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. This is GUID value. The display name should be assigned within + properties field. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar display_name: The user-defined name (display name) of the workbook. + :vartype display_name: str + :ivar serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :vartype serialized_data: str + :ivar time_modified: Date and time in UTC of the last modification that was made to this + workbook definition. + :vartype time_modified: str + :ivar category: Workbook category, as defined by the user at creation time. + :vartype category: str + :ivar version: Workbook version. + :vartype version: str + :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook + definition. + :vartype tags_properties_tags: list[str] + :ivar user_id: Unique user id of the specific user that owns this workbook. + :vartype user_id: str + :ivar source_id: ResourceId for a source resource. + :vartype source_id: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "time_modified": {"readonly": True}, + "user_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "kind": {"key": "kind", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "serialized_data": {"key": "properties.serializedData", "type": "str"}, + "time_modified": {"key": "properties.timeModified", "type": "str"}, + "category": {"key": "properties.category", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, + "user_id": {"key": "properties.userId", "type": "str"}, + "source_id": {"key": "properties.sourceId", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, + tags: Optional[dict[str, str]] = None, + display_name: Optional[str] = None, + serialized_data: Optional[str] = None, + category: Optional[str] = None, + version: Optional[str] = None, + tags_properties_tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :paramtype kind: str or + ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword display_name: The user-defined name (display name) of the workbook. + :paramtype display_name: str + :keyword serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :paramtype serialized_data: str + :keyword category: Workbook category, as defined by the user at creation time. + :paramtype category: str + :keyword version: Workbook version. + :paramtype version: str + :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook + definition. + :paramtype tags_properties_tags: list[str] + :keyword source_id: ResourceId for a source resource. + :paramtype source_id: str + """ + super().__init__(kind=kind, location=location, tags=tags, **kwargs) + self.display_name = display_name + self.serialized_data = serialized_data + self.time_modified: Optional[str] = None + self.category = category + self.version = version + self.tags_properties_tags = tags_properties_tags + self.user_id: Optional[str] = None + self.source_id = source_id + + +class WorkbookError(_serialization.Model): + """Error message body that will indicate why the operation failed. + + :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar details: The list of invalid fields send in request, in case of validation error. + :vartype details: + list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.ErrorFieldContract] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[ErrorFieldContract]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + details: Optional[list["_models.ErrorFieldContract"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :paramtype code: str + :keyword message: Human-readable representation of the error. + :paramtype message: str + :keyword details: The list of invalid fields send in request, in case of validation error. + :paramtype details: + list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.ErrorFieldContract] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.details = details + + +class WorkbooksListResult(_serialization.Model): + """Workbook list result. + + :ivar value: An array of workbooks. + :vartype value: list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Workbook]"}, + } + + def __init__(self, *, value: Optional[list["_models.Workbook"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of workbooks. + :paramtype value: list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook] + """ + super().__init__(**kwargs) + self.value = value + + +class WorkbookUpdateParameters(_serialization.Model): + """The parameters that can be provided when updating workbook properties properties. + + :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar display_name: The user-defined name (display name) of the workbook. + :vartype display_name: str + :ivar serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :vartype serialized_data: str + :ivar category: Workbook category, as defined by the user at creation time. + :vartype category: str + :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook + definition. + :vartype tags_properties_tags: list[str] + """ + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "serialized_data": {"key": "properties.serializedData", "type": "str"}, + "category": {"key": "properties.category", "type": "str"}, + "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, + tags: Optional[dict[str, str]] = None, + display_name: Optional[str] = None, + serialized_data: Optional[str] = None, + category: Optional[str] = None, + tags_properties_tags: Optional[list[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :paramtype kind: str or + ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword display_name: The user-defined name (display name) of the workbook. + :paramtype display_name: str + :keyword serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :paramtype serialized_data: str + :keyword category: Workbook category, as defined by the user at creation time. + :paramtype category: str + :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook + definition. + :paramtype tags_properties_tags: list[str] + """ + super().__init__(**kwargs) + self.kind = kind + self.tags = tags + self.display_name = display_name + self.serialized_data = serialized_data + self.category = category + self.tags_properties_tags = tags_properties_tags diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/__init__.py new file mode 100644 index 000000000000..aed9fd104c66 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._workbooks_operations import WorkbooksOperations # type: ignore +from ._operations import Operations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbooksOperations", + "Operations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_deleted_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_operations.py similarity index 64% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_deleted_workbooks_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_operations.py index 85f2783270bc..b278f1bbe7b9 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_deleted_workbooks_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_operations.py @@ -6,7 +6,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, List, Optional, TypeVar, Union +from typing import Any, Callable, Optional, TypeVar +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -29,38 +30,24 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_by_subscription_request( - subscription_id: str, - *, - category: Optional[Union[str, _models.CategoryType]] = None, - tags: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: +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", "2024-02-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-17-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/deletedWorkbooks") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore + _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/operations") # Construct parameters - if category is not None: - _params["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers @@ -69,14 +56,14 @@ def build_list_by_subscription_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class DeletedWorkbooksOperations: +class Operations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s - :attr:`deleted_workbooks` attribute. + :class:`~azure.mgmt.applicationinsights.v2018_06_17_preview.ApplicationInsightsManagementClient`'s + :attr:`operations` attribute. """ models = _models @@ -91,28 +78,19 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_by_subscription( - self, - category: Optional[Union[str, _models.CategoryType]] = None, - tags: Optional[List[str]] = None, - **kwargs: Any - ) -> ItemPaged["_models.DeletedWorkbook"]: - """Get all recently deleted Workbooks in a specified subscription. - - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Default value is None. - :type category: str or ~azure.mgmt.applicationinsights.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :return: An iterator like instance of either DeletedWorkbook or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.DeletedWorkbook] + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """Lists all of the available insights REST API operations. + + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) - cls: ClsType[_models.DeletedWorkbooksListResult] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -125,10 +103,7 @@ def list_by_subscription( def prepare_request(next_link=None): if not next_link: - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - category=category, - tags=tags, + _request = build_list_request( api_version=api_version, headers=_headers, params=_params, @@ -136,13 +111,24 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request def extract_data(pipeline_response): - deserialized = self._deserialize("DeletedWorkbooksListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore @@ -159,7 +145,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.DeletedWorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_workbooks_operations.py new file mode 100644 index 000000000000..a2b3b984f4bb --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_workbooks_operations.py @@ -0,0 +1,766 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + category: Union[str, _models.CategoryType], + source_id: str, + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-17-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks", + ) + 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["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, 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", "2018-06-17-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, 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", "2018-06-17-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, *, source_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", "2018-06-17-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, resource_name: str, subscription_id: str, *, source_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", "2018-06-17-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class WorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2018_06_17_preview.ApplicationInsightsManagementClient`'s + :attr:`workbooks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + category: Union[str, _models.CategoryType], + source_id: str, + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.CategoryType + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either Workbook or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + source_id=source_id, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbooksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Workbook: + """Get a single workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Delete a workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_properties: _models.Workbook, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_properties: Union[_models.Workbook, IO[bytes]], + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_properties: Properties that need to be specified to create a new workbook. Is + either a Workbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + or IO[bytes] + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "Workbook") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.WorkbookUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + source_id: str, + workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all related workbooks. Required. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.WorkbookUpdateParameters or + IO[bytes] + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_update_parameters else None + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if workbook_update_parameters else None + _json = None + _content = None + if isinstance(workbook_update_parameters, (IOBase, bytes)): + _content = workbook_update_parameters + else: + if workbook_update_parameters is not None: + _json = self._serialize.body(workbook_update_parameters, "WorkbookUpdateParameters") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_application_insights_management_client.py new file mode 100644 index 000000000000..821868f277b0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_application_insights_management_client.py @@ -0,0 +1,130 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import WorkbookTemplatesOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar workbook_templates: WorkbookTemplatesOperations operations + :vartype workbook_templates: + azure.mgmt.applicationinsights.v2019_10_17_preview.operations.WorkbookTemplatesOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2019-10-17-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.workbook_templates = WorkbookTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_configuration.py new file mode 100644 index 000000000000..9b30c6905066 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2019-10-17-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2019-10-17-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..49390908778f --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_application_insights_management_client.py @@ -0,0 +1,134 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import WorkbookTemplatesOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar workbook_templates: WorkbookTemplatesOperations operations + :vartype workbook_templates: + azure.mgmt.applicationinsights.v2019_10_17_preview.aio.operations.WorkbookTemplatesOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2019-10-17-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.workbook_templates = WorkbookTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_configuration.py new file mode 100644 index 000000000000..13fd78481100 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2019-10-17-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2019-10-17-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..aa730bc20e57 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._workbook_templates_operations import WorkbookTemplatesOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbookTemplatesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_workbook_templates_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_workbook_templates_operations.py new file mode 100644 index 000000000000..48b6b3da21b9 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_workbook_templates_operations.py @@ -0,0 +1,548 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._workbook_templates_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_update_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class WorkbookTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2019_10_17_preview.aio.ApplicationInsightsManagementClient`'s + :attr:`workbook_templates` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.WorkbookTemplate"]: + """Get all Workbook templates defined within a specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either WorkbookTemplate or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbookTemplatesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.WorkbookTemplate: + """Get a single workbook template by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Delete a workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: _models.WorkbookTemplate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Required. + :type workbook_template_properties: + ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Required. + :type workbook_template_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: Union[_models.WorkbookTemplate, IO[bytes]], + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Is either a WorkbookTemplate type or a IO[bytes] type. Required. + :type workbook_template_properties: + ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate or IO[bytes] + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_template_properties, (IOBase, bytes)): + _content = workbook_template_properties + else: + _json = self._serialize.body(workbook_template_properties, "WorkbookTemplate") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[_models.WorkbookTemplateUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Default value is None. + :type workbook_template_update_parameters: + ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Default value is None. + :type workbook_template_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[ + Union[_models.WorkbookTemplateUpdateParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Is either a WorkbookTemplateUpdateParameters type or a IO[bytes] type. + Default value is None. + :type workbook_template_update_parameters: + ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateUpdateParameters or + IO[bytes] + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_template_update_parameters else None + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if workbook_template_update_parameters else None + _json = None + _content = None + if isinstance(workbook_template_update_parameters, (IOBase, bytes)): + _content = workbook_template_update_parameters + else: + if workbook_template_update_parameters is not None: + _json = self._serialize.body(workbook_template_update_parameters, "WorkbookTemplateUpdateParameters") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/__init__.py new file mode 100644 index 000000000000..9624ccdad420 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ErrorFieldContract, + WorkbookError, + WorkbookTemplate, + WorkbookTemplateGallery, + WorkbookTemplateLocalizedGallery, + WorkbookTemplateResource, + WorkbookTemplateUpdateParameters, + WorkbookTemplatesListResult, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ErrorFieldContract", + "WorkbookError", + "WorkbookTemplate", + "WorkbookTemplateGallery", + "WorkbookTemplateLocalizedGallery", + "WorkbookTemplateResource", + "WorkbookTemplateUpdateParameters", + "WorkbookTemplatesListResult", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_models_py3.py new file mode 100644 index 000000000000..8a805a1353f6 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_models_py3.py @@ -0,0 +1,412 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from collections.abc import MutableMapping +from typing import Any, Optional, TYPE_CHECKING + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models +JSON = MutableMapping[str, Any] + + +class ErrorFieldContract(_serialization.Model): + """Error Field contract. + + :ivar code: Property level error code. + :vartype code: str + :ivar message: Human-readable representation of property-level error. + :vartype message: str + :ivar target: Property name. + :vartype target: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword code: Property level error code. + :paramtype code: str + :keyword message: Human-readable representation of property-level error. + :paramtype message: str + :keyword target: Property name. + :paramtype target: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + + +class WorkbookError(_serialization.Model): + """Error message body that will indicate why the operation failed. + + :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar details: The list of invalid fields send in request, in case of validation error. + :vartype details: + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.ErrorFieldContract] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[ErrorFieldContract]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + details: Optional[list["_models.ErrorFieldContract"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :paramtype code: str + :keyword message: Human-readable representation of the error. + :paramtype message: str + :keyword details: The list of invalid fields send in request, in case of validation error. + :paramtype details: + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.ErrorFieldContract] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.details = details + + +class WorkbookTemplateResource(_serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.tags = tags + + +class WorkbookTemplate(WorkbookTemplateResource): + """An Application Insights workbook template definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar priority: Priority of the template. Determines which template to open when a workbook + gallery is opened in viewer mode. + :vartype priority: int + :ivar author: Information about the author of the workbook template. + :vartype author: str + :ivar template_data: Valid JSON object containing workbook template payload. + :vartype template_data: JSON + :ivar galleries: Workbook galleries supported by the template. + :vartype galleries: + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] + :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages + supported by the Azure portal. + :vartype localized: dict[str, + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateLocalizedGallery]] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "priority": {"key": "properties.priority", "type": "int"}, + "author": {"key": "properties.author", "type": "str"}, + "template_data": {"key": "properties.templateData", "type": "object"}, + "galleries": {"key": "properties.galleries", "type": "[WorkbookTemplateGallery]"}, + "localized": {"key": "properties.localized", "type": "{[WorkbookTemplateLocalizedGallery]}"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + priority: Optional[int] = None, + author: Optional[str] = None, + template_data: Optional[JSON] = None, + galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, + localized: Optional[dict[str, list["_models.WorkbookTemplateLocalizedGallery"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword priority: Priority of the template. Determines which template to open when a workbook + gallery is opened in viewer mode. + :paramtype priority: int + :keyword author: Information about the author of the workbook template. + :paramtype author: str + :keyword template_data: Valid JSON object containing workbook template payload. + :paramtype template_data: JSON + :keyword galleries: Workbook galleries supported by the template. + :paramtype galleries: + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] + :keyword localized: Key value pair of localized gallery. Each key is the locale code of + languages supported by the Azure portal. + :paramtype localized: dict[str, + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateLocalizedGallery]] + """ + super().__init__(location=location, tags=tags, **kwargs) + self.priority = priority + self.author = author + self.template_data = template_data + self.galleries = galleries + self.localized = localized + + +class WorkbookTemplateGallery(_serialization.Model): + """Gallery information for a workbook template. + + :ivar name: Name of the workbook template in the gallery. + :vartype name: str + :ivar category: Category for the gallery. + :vartype category: str + :ivar type: Type of workbook supported by the workbook template. + :vartype type: str + :ivar order: Order of the template within the gallery. + :vartype order: int + :ivar resource_type: Azure resource type supported by the gallery. + :vartype resource_type: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "order": {"key": "order", "type": "int"}, + "resource_type": {"key": "resourceType", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + category: Optional[str] = None, + type: Optional[str] = None, + order: Optional[int] = None, + resource_type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the workbook template in the gallery. + :paramtype name: str + :keyword category: Category for the gallery. + :paramtype category: str + :keyword type: Type of workbook supported by the workbook template. + :paramtype type: str + :keyword order: Order of the template within the gallery. + :paramtype order: int + :keyword resource_type: Azure resource type supported by the gallery. + :paramtype resource_type: str + """ + super().__init__(**kwargs) + self.name = name + self.category = category + self.type = type + self.order = order + self.resource_type = resource_type + + +class WorkbookTemplateLocalizedGallery(_serialization.Model): + """Localized template data and gallery information. + + :ivar template_data: Valid JSON object containing workbook template payload. + :vartype template_data: JSON + :ivar galleries: Workbook galleries supported by the template. + :vartype galleries: + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] + """ + + _attribute_map = { + "template_data": {"key": "templateData", "type": "object"}, + "galleries": {"key": "galleries", "type": "[WorkbookTemplateGallery]"}, + } + + def __init__( + self, + *, + template_data: Optional[JSON] = None, + galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword template_data: Valid JSON object containing workbook template payload. + :paramtype template_data: JSON + :keyword galleries: Workbook galleries supported by the template. + :paramtype galleries: + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] + """ + super().__init__(**kwargs) + self.template_data = template_data + self.galleries = galleries + + +class WorkbookTemplatesListResult(_serialization.Model): + """WorkbookTemplate list result. + + :ivar value: An array of workbook templates. + :vartype value: + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[WorkbookTemplate]"}, + } + + def __init__(self, *, value: Optional[list["_models.WorkbookTemplate"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of workbook templates. + :paramtype value: + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate] + """ + super().__init__(**kwargs) + self.value = value + + +class WorkbookTemplateUpdateParameters(_serialization.Model): + """The parameters that can be provided when updating workbook template. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar priority: Priority of the template. Determines which template to open when a workbook + gallery is opened in viewer mode. + :vartype priority: int + :ivar author: Information about the author of the workbook template. + :vartype author: str + :ivar template_data: Valid JSON object containing workbook template payload. + :vartype template_data: JSON + :ivar galleries: Workbook galleries supported by the template. + :vartype galleries: + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] + :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages + supported by the Azure portal. + :vartype localized: dict[str, + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateLocalizedGallery]] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "priority": {"key": "properties.priority", "type": "int"}, + "author": {"key": "properties.author", "type": "str"}, + "template_data": {"key": "properties.templateData", "type": "object"}, + "galleries": {"key": "properties.galleries", "type": "[WorkbookTemplateGallery]"}, + "localized": {"key": "properties.localized", "type": "{[WorkbookTemplateLocalizedGallery]}"}, + } + + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + priority: Optional[int] = None, + author: Optional[str] = None, + template_data: Optional[JSON] = None, + galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, + localized: Optional[dict[str, list["_models.WorkbookTemplateLocalizedGallery"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword priority: Priority of the template. Determines which template to open when a workbook + gallery is opened in viewer mode. + :paramtype priority: int + :keyword author: Information about the author of the workbook template. + :paramtype author: str + :keyword template_data: Valid JSON object containing workbook template payload. + :paramtype template_data: JSON + :keyword galleries: Workbook galleries supported by the template. + :paramtype galleries: + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] + :keyword localized: Key value pair of localized gallery. Each key is the locale code of + languages supported by the Azure portal. + :paramtype localized: dict[str, + list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateLocalizedGallery]] + """ + super().__init__(**kwargs) + self.tags = tags + self.priority = priority + self.author = author + self.template_data = template_data + self.galleries = galleries + self.localized = localized diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/__init__.py new file mode 100644 index 000000000000..aa730bc20e57 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._workbook_templates_operations import WorkbookTemplatesOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbookTemplatesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_workbook_templates_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_workbook_templates_operations.py new file mode 100644 index 000000000000..691e1f5bd41b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_workbook_templates_operations.py @@ -0,0 +1,709 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +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_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-10-17-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooktemplates", + ) + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, 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", "2019-10-17-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooktemplates/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, 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", "2019-10-17-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooktemplates/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, 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", "2019-10-17-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooktemplates/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, 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", "2019-10-17-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooktemplates/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class WorkbookTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2019_10_17_preview.ApplicationInsightsManagementClient`'s + :attr:`workbook_templates` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.WorkbookTemplate"]: + """Get all Workbook templates defined within a specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either WorkbookTemplate or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbookTemplatesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.WorkbookTemplate: + """Get a single workbook template by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Delete a workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: _models.WorkbookTemplate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Required. + :type workbook_template_properties: + ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Required. + :type workbook_template_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: Union[_models.WorkbookTemplate, IO[bytes]], + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Is either a WorkbookTemplate type or a IO[bytes] type. Required. + :type workbook_template_properties: + ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate or IO[bytes] + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_template_properties, (IOBase, bytes)): + _content = workbook_template_properties + else: + _json = self._serialize.body(workbook_template_properties, "WorkbookTemplate") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[_models.WorkbookTemplateUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Default value is None. + :type workbook_template_update_parameters: + ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Default value is None. + :type workbook_template_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[ + Union[_models.WorkbookTemplateUpdateParameters, IO[bytes]] + ] = None, + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Is either a WorkbookTemplateUpdateParameters type or a IO[bytes] type. + Default value is None. + :type workbook_template_update_parameters: + ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateUpdateParameters or + IO[bytes] + :return: WorkbookTemplate or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_template_update_parameters else None + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if workbook_template_update_parameters else None + _json = None + _content = None + if isinstance(workbook_template_update_parameters, (IOBase, bytes)): + _content = workbook_template_update_parameters + else: + if workbook_template_update_parameters is not None: + _json = self._serialize.body(workbook_template_update_parameters, "WorkbookTemplateUpdateParameters") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_application_insights_management_client.py new file mode 100644 index 000000000000..fa4e499c82e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_application_insights_management_client.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import ComponentsOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar components: ComponentsOperations operations + :vartype components: azure.mgmt.applicationinsights.v2020_02_02.operations.ComponentsOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-02-02". 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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_configuration.py new file mode 100644 index 000000000000..1881dc428148 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-02-02". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2020-02-02") + + 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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..9e392c3bdb27 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_application_insights_management_client.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import ComponentsOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar components: ComponentsOperations operations + :vartype components: + azure.mgmt.applicationinsights.v2020_02_02.aio.operations.ComponentsOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-02-02". 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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_configuration.py new file mode 100644 index 000000000000..a9d5aa5fbc2c --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-02-02". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2020-02-02") + + 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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/__init__.py new file mode 100644 index 000000000000..ab50c30fbaac --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._components_operations import ComponentsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComponentsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_components_operations.py new file mode 100644 index 000000000000..7cc8daae5d0d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_components_operations.py @@ -0,0 +1,859 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._components_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_purge_status_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_purge_request, + build_update_tags_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class ComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2020_02_02.aio.ApplicationInsightsManagementClient`'s + :attr:`components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of all Application Insights components within a subscription. + + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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.ErrorResponseComponents, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of Application Insights components within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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.ErrorResponseComponents, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Deletes an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Returns an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: _models.ApplicationInsightsComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. + Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent or IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(insight_properties, (IOBase, bytes)): + _content = insight_properties + else: + _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: Union[_models.TagsResource, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Is either a + TagsResource type or a IO[bytes] type. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02.models.TagsResource or + IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(component_tags, (IOBase, bytes)): + _content = component_tags + else: + _json = self._serialize.body(component_tags, "TagsResource") + + _request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: _models.ComponentPurgeBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , + scoped to specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , + scoped to specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: Union[_models.ComponentPurgeBody, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , + scoped to specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBody or IO[bytes] + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ComponentPurgeBody") + + _request = build_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_purge_status( + self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any + ) -> _models.ComponentPurgeStatusResponse: + """Get status for an ongoing purge operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param purge_id: In a purge status request, this is the Id of the operation the status of which + is returned. Required. + :type purge_id: str + :return: ComponentPurgeStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) + + _request = build_get_purge_status_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + purge_id=purge_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/__init__.py new file mode 100644 index 000000000000..3970e25b69c3 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ApplicationInsightsComponent, + ApplicationInsightsComponentListResult, + ComponentPurgeBody, + ComponentPurgeBodyFilters, + ComponentPurgeResponse, + ComponentPurgeStatusResponse, + ComponentsResource, + ErrorResponseComponents, + ErrorResponseComponentsError, + PrivateLinkScopedResource, + TagsResource, +) + +from ._application_insights_management_client_enums import ( # type: ignore + ApplicationType, + FlowType, + IngestionMode, + PublicNetworkAccessType, + PurgeState, + RequestSource, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsComponent", + "ApplicationInsightsComponentListResult", + "ComponentPurgeBody", + "ComponentPurgeBodyFilters", + "ComponentPurgeResponse", + "ComponentPurgeStatusResponse", + "ComponentsResource", + "ErrorResponseComponents", + "ErrorResponseComponentsError", + "PrivateLinkScopedResource", + "TagsResource", + "ApplicationType", + "FlowType", + "IngestionMode", + "PublicNetworkAccessType", + "PurgeState", + "RequestSource", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_application_insights_management_client_enums.py new file mode 100644 index 000000000000..8b3d890ab9d8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_application_insights_management_client_enums.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 ApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of application being monitored.""" + + WEB = "web" + OTHER = "other" + + +class FlowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Used by the Application Insights system to determine what kind of flow this component was + created by. This is to be set to 'Bluefield' when creating/updating a component via the REST + API. + """ + + BLUEFIELD = "Bluefield" + + +class IngestionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the flow of the ingestion.""" + + APPLICATION_INSIGHTS = "ApplicationInsights" + APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS = "ApplicationInsightsWithDiagnosticSettings" + LOG_ANALYTICS = "LogAnalytics" + + +class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The network access type for operating on the Application Insights Component. By default it is + Enabled. + """ + + ENABLED = "Enabled" + """Enables connectivity to Application Insights through public DNS.""" + DISABLED = "Disabled" + """Disables public connectivity to Application Insights through public DNS.""" + + +class PurgeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the operation represented by the requested Id.""" + + PENDING = "pending" + COMPLETED = "completed" + + +class RequestSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes what tool created this Application Insights component. Customers using this API + should set this to the default 'rest'. + """ + + REST = "rest" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_models_py3.py new file mode 100644 index 000000000000..8c6a05e7ad8a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_models_py3.py @@ -0,0 +1,615 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, Optional, TYPE_CHECKING, Union + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models + + +class ComponentsResource(_serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.tags = tags + + +class ApplicationInsightsComponent(ComponentsResource): + """An Application Insights component definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind of application that this component refers to, used to customize UI. This + value is a freeform string, values should typically be one of the following: web, ios, other, + store, java, phone. Required. + :vartype kind: str + :ivar etag: Resource etag. + :vartype etag: str + :ivar application_id: The unique ID of your application. This field mirrors the 'Name' field + and cannot be changed. + :vartype application_id: str + :ivar app_id: Application Insights Unique ID for your Application. + :vartype app_id: str + :ivar name_properties_name: Application name. + :vartype name_properties_name: str + :ivar application_type: Type of application being monitored. Known values are: "web" and + "other". + :vartype application_type: str or + ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationType + :ivar flow_type: Used by the Application Insights system to determine what kind of flow this + component was created by. This is to be set to 'Bluefield' when creating/updating a component + via the REST API. "Bluefield" + :vartype flow_type: str or ~azure.mgmt.applicationinsights.v2020_02_02.models.FlowType + :ivar request_source: Describes what tool created this Application Insights component. + Customers using this API should set this to the default 'rest'. "rest" + :vartype request_source: str or + ~azure.mgmt.applicationinsights.v2020_02_02.models.RequestSource + :ivar instrumentation_key: Application Insights Instrumentation key. A read-only value that + applications can use to identify the destination for all telemetry sent to Azure Application + Insights. This value will be supplied upon construction of each new Application Insights + component. + :vartype instrumentation_key: str + :ivar creation_date: Creation Date for the Application Insights component, in ISO 8601 format. + :vartype creation_date: ~datetime.datetime + :ivar tenant_id: Azure Tenant Id. + :vartype tenant_id: str + :ivar hockey_app_id: The unique application ID created when a new application is added to + HockeyApp, used for communications with HockeyApp. + :vartype hockey_app_id: str + :ivar hockey_app_token: Token used to authenticate communications with between Application + Insights and HockeyApp. + :vartype hockey_app_token: str + :ivar provisioning_state: Current state of this component: whether or not is has been + provisioned within the resource group it is defined. Users cannot change this value but are + able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + :vartype provisioning_state: str + :ivar sampling_percentage: Percentage of the data produced by the application being monitored + that is being sampled for Application Insights telemetry. + :vartype sampling_percentage: float + :ivar connection_string: Application Insights component connection string. + :vartype connection_string: str + :ivar retention_in_days: Retention period in days. + :vartype retention_in_days: int + :ivar disable_ip_masking: Disable IP masking. + :vartype disable_ip_masking: bool + :ivar immediate_purge_data_on30_days: Purge data immediately after 30 days. + :vartype immediate_purge_data_on30_days: bool + :ivar workspace_resource_id: Resource Id of the log analytics workspace which the data will be + ingested to. This property is required to create an application with this API version. + Applications from older versions will not have this property. + :vartype workspace_resource_id: str + :ivar la_migration_date: The date which the component got migrated to LA, in ISO 8601 format. + :vartype la_migration_date: ~datetime.datetime + :ivar private_link_scoped_resources: List of linked private link scope resources. + :vartype private_link_scoped_resources: + list[~azure.mgmt.applicationinsights.v2020_02_02.models.PrivateLinkScopedResource] + :ivar public_network_access_for_ingestion: The network access type for accessing Application + Insights ingestion. Known values are: "Enabled" and "Disabled". + :vartype public_network_access_for_ingestion: str or + ~azure.mgmt.applicationinsights.v2020_02_02.models.PublicNetworkAccessType + :ivar public_network_access_for_query: The network access type for accessing Application + Insights query. Known values are: "Enabled" and "Disabled". + :vartype public_network_access_for_query: str or + ~azure.mgmt.applicationinsights.v2020_02_02.models.PublicNetworkAccessType + :ivar ingestion_mode: Indicates the flow of the ingestion. Known values are: + "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". + :vartype ingestion_mode: str or + ~azure.mgmt.applicationinsights.v2020_02_02.models.IngestionMode + :ivar disable_local_auth: Disable Non-AAD based Auth. + :vartype disable_local_auth: bool + :ivar force_customer_storage_for_profiler: Force users to create their own storage account for + profiler and debugger. + :vartype force_customer_storage_for_profiler: bool + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "kind": {"required": True}, + "application_id": {"readonly": True}, + "app_id": {"readonly": True}, + "name_properties_name": {"readonly": True}, + "instrumentation_key": {"readonly": True}, + "creation_date": {"readonly": True}, + "tenant_id": {"readonly": True}, + "hockey_app_token": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "connection_string": {"readonly": True}, + "la_migration_date": {"readonly": True}, + "private_link_scoped_resources": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kind": {"key": "kind", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "application_id": {"key": "properties.ApplicationId", "type": "str"}, + "app_id": {"key": "properties.AppId", "type": "str"}, + "name_properties_name": {"key": "properties.Name", "type": "str"}, + "application_type": {"key": "properties.Application_Type", "type": "str"}, + "flow_type": {"key": "properties.Flow_Type", "type": "str"}, + "request_source": {"key": "properties.Request_Source", "type": "str"}, + "instrumentation_key": {"key": "properties.InstrumentationKey", "type": "str"}, + "creation_date": {"key": "properties.CreationDate", "type": "iso-8601"}, + "tenant_id": {"key": "properties.TenantId", "type": "str"}, + "hockey_app_id": {"key": "properties.HockeyAppId", "type": "str"}, + "hockey_app_token": {"key": "properties.HockeyAppToken", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "sampling_percentage": {"key": "properties.SamplingPercentage", "type": "float"}, + "connection_string": {"key": "properties.ConnectionString", "type": "str"}, + "retention_in_days": {"key": "properties.RetentionInDays", "type": "int"}, + "disable_ip_masking": {"key": "properties.DisableIpMasking", "type": "bool"}, + "immediate_purge_data_on30_days": {"key": "properties.ImmediatePurgeDataOn30Days", "type": "bool"}, + "workspace_resource_id": {"key": "properties.WorkspaceResourceId", "type": "str"}, + "la_migration_date": {"key": "properties.LaMigrationDate", "type": "iso-8601"}, + "private_link_scoped_resources": { + "key": "properties.PrivateLinkScopedResources", + "type": "[PrivateLinkScopedResource]", + }, + "public_network_access_for_ingestion": {"key": "properties.publicNetworkAccessForIngestion", "type": "str"}, + "public_network_access_for_query": {"key": "properties.publicNetworkAccessForQuery", "type": "str"}, + "ingestion_mode": {"key": "properties.IngestionMode", "type": "str"}, + "disable_local_auth": {"key": "properties.DisableLocalAuth", "type": "bool"}, + "force_customer_storage_for_profiler": {"key": "properties.ForceCustomerStorageForProfiler", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + kind: str, + tags: Optional[dict[str, str]] = None, + etag: Optional[str] = None, + application_type: Union[str, "_models.ApplicationType"] = "web", + flow_type: Union[str, "_models.FlowType"] = "Bluefield", + request_source: Union[str, "_models.RequestSource"] = "rest", + hockey_app_id: Optional[str] = None, + sampling_percentage: Optional[float] = None, + retention_in_days: Optional[int] = None, + disable_ip_masking: Optional[bool] = None, + immediate_purge_data_on30_days: Optional[bool] = None, + workspace_resource_id: Optional[str] = None, + public_network_access_for_ingestion: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", + public_network_access_for_query: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", + ingestion_mode: Union[str, "_models.IngestionMode"] = "LogAnalytics", + disable_local_auth: Optional[bool] = None, + force_customer_storage_for_profiler: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword kind: The kind of application that this component refers to, used to customize UI. + This value is a freeform string, values should typically be one of the following: web, ios, + other, store, java, phone. Required. + :paramtype kind: str + :keyword etag: Resource etag. + :paramtype etag: str + :keyword application_type: Type of application being monitored. Known values are: "web" and + "other". + :paramtype application_type: str or + ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationType + :keyword flow_type: Used by the Application Insights system to determine what kind of flow this + component was created by. This is to be set to 'Bluefield' when creating/updating a component + via the REST API. "Bluefield" + :paramtype flow_type: str or ~azure.mgmt.applicationinsights.v2020_02_02.models.FlowType + :keyword request_source: Describes what tool created this Application Insights component. + Customers using this API should set this to the default 'rest'. "rest" + :paramtype request_source: str or + ~azure.mgmt.applicationinsights.v2020_02_02.models.RequestSource + :keyword hockey_app_id: The unique application ID created when a new application is added to + HockeyApp, used for communications with HockeyApp. + :paramtype hockey_app_id: str + :keyword sampling_percentage: Percentage of the data produced by the application being + monitored that is being sampled for Application Insights telemetry. + :paramtype sampling_percentage: float + :keyword retention_in_days: Retention period in days. + :paramtype retention_in_days: int + :keyword disable_ip_masking: Disable IP masking. + :paramtype disable_ip_masking: bool + :keyword immediate_purge_data_on30_days: Purge data immediately after 30 days. + :paramtype immediate_purge_data_on30_days: bool + :keyword workspace_resource_id: Resource Id of the log analytics workspace which the data will + be ingested to. This property is required to create an application with this API version. + Applications from older versions will not have this property. + :paramtype workspace_resource_id: str + :keyword public_network_access_for_ingestion: The network access type for accessing Application + Insights ingestion. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access_for_ingestion: str or + ~azure.mgmt.applicationinsights.v2020_02_02.models.PublicNetworkAccessType + :keyword public_network_access_for_query: The network access type for accessing Application + Insights query. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access_for_query: str or + ~azure.mgmt.applicationinsights.v2020_02_02.models.PublicNetworkAccessType + :keyword ingestion_mode: Indicates the flow of the ingestion. Known values are: + "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". + :paramtype ingestion_mode: str or + ~azure.mgmt.applicationinsights.v2020_02_02.models.IngestionMode + :keyword disable_local_auth: Disable Non-AAD based Auth. + :paramtype disable_local_auth: bool + :keyword force_customer_storage_for_profiler: Force users to create their own storage account + for profiler and debugger. + :paramtype force_customer_storage_for_profiler: bool + """ + super().__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.etag = etag + self.application_id: Optional[str] = None + self.app_id: Optional[str] = None + self.name_properties_name: Optional[str] = None + self.application_type = application_type + self.flow_type = flow_type + self.request_source = request_source + self.instrumentation_key: Optional[str] = None + self.creation_date: Optional[datetime.datetime] = None + self.tenant_id: Optional[str] = None + self.hockey_app_id = hockey_app_id + self.hockey_app_token: Optional[str] = None + self.provisioning_state: Optional[str] = None + self.sampling_percentage = sampling_percentage + self.connection_string: Optional[str] = None + self.retention_in_days = retention_in_days + self.disable_ip_masking = disable_ip_masking + self.immediate_purge_data_on30_days = immediate_purge_data_on30_days + self.workspace_resource_id = workspace_resource_id + self.la_migration_date: Optional[datetime.datetime] = None + self.private_link_scoped_resources: Optional[list["_models.PrivateLinkScopedResource"]] = None + self.public_network_access_for_ingestion = public_network_access_for_ingestion + self.public_network_access_for_query = public_network_access_for_query + self.ingestion_mode = ingestion_mode + self.disable_local_auth = disable_local_auth + self.force_customer_storage_for_profiler = force_customer_storage_for_profiler + + +class ApplicationInsightsComponentListResult(_serialization.Model): + """Describes the list of Application Insights Resources. + + All required parameters must be populated in order to send to server. + + :ivar value: List of Application Insights component definitions. Required. + :vartype value: + list[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] + :ivar next_link: The URI to get the next set of Application Insights component definitions if + too many components where returned in the result set. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationInsightsComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: list["_models.ApplicationInsightsComponent"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of Application Insights component definitions. Required. + :paramtype value: + list[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] + :keyword next_link: The URI to get the next set of Application Insights component definitions + if too many components where returned in the result set. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ComponentPurgeBody(_serialization.Model): + """Describes the body of a purge request for an App Insights component. + + All required parameters must be populated in order to send to server. + + :ivar table: Table from which to purge data. Required. + :vartype table: str + :ivar filters: The set of columns and filters (queries) to run over them to purge the resulting + data. Required. + :vartype filters: + list[~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBodyFilters] + """ + + _validation = { + "table": {"required": True}, + "filters": {"required": True}, + } + + _attribute_map = { + "table": {"key": "table", "type": "str"}, + "filters": {"key": "filters", "type": "[ComponentPurgeBodyFilters]"}, + } + + def __init__(self, *, table: str, filters: list["_models.ComponentPurgeBodyFilters"], **kwargs: Any) -> None: + """ + :keyword table: Table from which to purge data. Required. + :paramtype table: str + :keyword filters: The set of columns and filters (queries) to run over them to purge the + resulting data. Required. + :paramtype filters: + list[~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBodyFilters] + """ + super().__init__(**kwargs) + self.table = table + self.filters = filters + + +class ComponentPurgeBodyFilters(_serialization.Model): + """User-defined filters to return data which will be purged from the table. + + :ivar column: The column of the table over which the given query should run. + :vartype column: str + :ivar operator: A query operator to evaluate over the provided column and value(s). Supported + operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would + in a KQL query. + :vartype operator: str + :ivar value: the value for the operator to function over. This can be a number (e.g., > 100), a + string (timestamp >= '2017-09-01') or array of values. + :vartype value: any + :ivar key: When filtering over custom dimensions, this key will be used as the name of the + custom dimension. + :vartype key: str + """ + + _attribute_map = { + "column": {"key": "column", "type": "str"}, + "operator": {"key": "operator", "type": "str"}, + "value": {"key": "value", "type": "object"}, + "key": {"key": "key", "type": "str"}, + } + + def __init__( + self, + *, + column: Optional[str] = None, + operator: Optional[str] = None, + value: Optional[Any] = None, + key: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword column: The column of the table over which the given query should run. + :paramtype column: str + :keyword operator: A query operator to evaluate over the provided column and value(s). + Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as + they would in a KQL query. + :paramtype operator: str + :keyword value: the value for the operator to function over. This can be a number (e.g., > + 100), a string (timestamp >= '2017-09-01') or array of values. + :paramtype value: any + :keyword key: When filtering over custom dimensions, this key will be used as the name of the + custom dimension. + :paramtype key: str + """ + super().__init__(**kwargs) + self.column = column + self.operator = operator + self.value = value + self.key = key + + +class ComponentPurgeResponse(_serialization.Model): + """Response containing operationId for a specific purge action. + + All required parameters must be populated in order to send to server. + + :ivar operation_id: Id to use when querying for status for a particular purge operation. + Required. + :vartype operation_id: str + """ + + _validation = { + "operation_id": {"required": True}, + } + + _attribute_map = { + "operation_id": {"key": "operationId", "type": "str"}, + } + + def __init__(self, *, operation_id: str, **kwargs: Any) -> None: + """ + :keyword operation_id: Id to use when querying for status for a particular purge operation. + Required. + :paramtype operation_id: str + """ + super().__init__(**kwargs) + self.operation_id = operation_id + + +class ComponentPurgeStatusResponse(_serialization.Model): + """Response containing status for a specific purge operation. + + All required parameters must be populated in order to send to server. + + :ivar status: Status of the operation represented by the requested Id. Required. Known values + are: "pending" and "completed". + :vartype status: str or ~azure.mgmt.applicationinsights.v2020_02_02.models.PurgeState + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, *, status: Union[str, "_models.PurgeState"], **kwargs: Any) -> None: + """ + :keyword status: Status of the operation represented by the requested Id. Required. Known + values are: "pending" and "completed". + :paramtype status: str or ~azure.mgmt.applicationinsights.v2020_02_02.models.PurgeState + """ + super().__init__(**kwargs) + self.status = status + + +class ErrorResponseComponents(_serialization.Model): + """ErrorResponseComponents. + + :ivar error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :vartype error: ~azure.mgmt.applicationinsights.v2020_02_02.models.ErrorResponseComponentsError + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorResponseComponentsError"}, + } + + def __init__(self, *, error: Optional["_models.ErrorResponseComponentsError"] = None, **kwargs: Any) -> None: + """ + :keyword error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :paramtype error: + ~azure.mgmt.applicationinsights.v2020_02_02.models.ErrorResponseComponentsError + """ + super().__init__(**kwargs) + self.error = error + + +class ErrorResponseComponentsError(_serialization.Model): + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None + + +class PrivateLinkScopedResource(_serialization.Model): + """The private link scope resource reference. + + :ivar resource_id: The full resource Id of the private link scope resource. + :vartype resource_id: str + :ivar scope_id: The private link scope unique Identifier. + :vartype scope_id: str + """ + + _attribute_map = { + "resource_id": {"key": "ResourceId", "type": "str"}, + "scope_id": {"key": "ScopeId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, scope_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The full resource Id of the private link scope resource. + :paramtype resource_id: str + :keyword scope_id: The private link scope unique Identifier. + :paramtype scope_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.scope_id = scope_id + + +class TagsResource(_serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on a + WebTest instance. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/__init__.py new file mode 100644 index 000000000000..ab50c30fbaac --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._components_operations import ComponentsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComponentsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_components_operations.py similarity index 89% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_components_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_components_operations.py index 4662d3e7f289..e9a03db31b40 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_components_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_components_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -31,7 +32,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -303,7 +305,7 @@ class ComponentsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2020_02_02.ApplicationInsightsManagementClient`'s :attr:`components` attribute. """ @@ -325,13 +327,13 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.ApplicationInsightsComponent :return: An iterator like instance of either ApplicationInsightsComponent or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent] + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] :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", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -354,7 +356,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -377,7 +390,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -396,13 +412,13 @@ def list_by_resource_group( :return: An iterator like instance of either ApplicationInsightsComponent or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent] + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] :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", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -426,7 +442,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -449,7 +476,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -482,7 +512,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -504,7 +534,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -520,7 +553,7 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -534,7 +567,7 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) _request = build_get_request( @@ -556,7 +589,10 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) @@ -586,12 +622,13 @@ def create_or_update( :type resource_name: str :param insight_properties: Properties that need to be specified to create an Application Insights component. Required. - :type insight_properties: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :type insight_properties: + ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ @@ -620,7 +657,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ @@ -643,10 +680,10 @@ def create_or_update( :param insight_properties: Properties that need to be specified to create an Application Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. Required. - :type insight_properties: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent - or IO[bytes] + :type insight_properties: + ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent or IO[bytes] :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -660,7 +697,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) @@ -694,7 +731,10 @@ def create_or_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) @@ -722,12 +762,12 @@ def update_tags( :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: ~azure.mgmt.applicationinsights.models.TagsResource + :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02.models.TagsResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ @@ -754,7 +794,7 @@ def update_tags( Default value is "application/json". :paramtype content_type: str :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ @@ -775,9 +815,10 @@ def update_tags( :type resource_name: str :param component_tags: Updated tag information to set into the component instance. Is either a TagsResource type or a IO[bytes] type. Required. - :type component_tags: ~azure.mgmt.applicationinsights.models.TagsResource or IO[bytes] + :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02.models.TagsResource or + IO[bytes] :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -791,7 +832,7 @@ def update_tags( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) @@ -825,7 +866,10 @@ def update_tags( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) @@ -864,12 +908,12 @@ def purge( :type resource_name: str :param body: Describes the body of a request to purge data in a single table of an Application Insights component. Required. - :type body: ~azure.mgmt.applicationinsights.models.ComponentPurgeBody + :type body: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBody :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -907,7 +951,7 @@ def purge( Default value is "application/json". :paramtype content_type: str :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse :raises ~azure.core.exceptions.HttpResponseError: """ @@ -938,9 +982,9 @@ def purge( :type resource_name: str :param body: Describes the body of a request to purge data in a single table of an Application Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.applicationinsights.models.ComponentPurgeBody or IO[bytes] + :type body: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBody or IO[bytes] :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -954,7 +998,7 @@ def purge( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) @@ -988,7 +1032,10 @@ def purge( if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) @@ -1013,7 +1060,7 @@ def get_purge_status( is returned. Required. :type purge_id: str :return: ComponentPurgeStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeStatusResponse + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeStatusResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1027,7 +1074,7 @@ def get_purge_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) _request = build_get_purge_status_request( @@ -1050,7 +1097,10 @@ def get_purge_status( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseComponents, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseComponents, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_application_insights_management_client.py new file mode 100644 index 000000000000..1eeeb60e6df9 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_application_insights_management_client.py @@ -0,0 +1,128 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import ComponentsOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar components: ComponentsOperations operations + :vartype components: + azure.mgmt.applicationinsights.v2020_02_02_preview.operations.ComponentsOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-02-02-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_configuration.py new file mode 100644 index 000000000000..3625df15bc75 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-02-02-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2020-02-02-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..9c564cdf2f1e --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_application_insights_management_client.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import ComponentsOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar components: ComponentsOperations operations + :vartype components: + azure.mgmt.applicationinsights.v2020_02_02_preview.aio.operations.ComponentsOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-02-02-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_configuration.py new file mode 100644 index 000000000000..83eed3c75f44 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-02-02-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2020-02-02-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..ab50c30fbaac --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._components_operations import ComponentsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComponentsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_components_operations.py new file mode 100644 index 000000000000..6cd1abf32b45 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_components_operations.py @@ -0,0 +1,849 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._components_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_purge_status_request, + build_get_request, + build_list_by_resource_group_request, + build_list_request, + build_purge_request, + build_update_tags_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class ComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2020_02_02_preview.aio.ApplicationInsightsManagementClient`'s + :attr:`components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of all Application Insights components within a subscription. + + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of Application Insights components within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Deletes an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Returns an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: _models.ApplicationInsightsComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. + Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent or + IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(insight_properties, (IOBase, bytes)): + _content = insight_properties + else: + _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: Union[_models.TagsResource, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Is either a + TagsResource type or a IO[bytes] type. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.TagsResource + or IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(component_tags, (IOBase, bytes)): + _content = component_tags + else: + _json = self._serialize.body(component_tags, "TagsResource") + + _request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: _models.ComponentPurgeBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: Union[_models.ComponentPurgeBody, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBody or + IO[bytes] + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ComponentPurgeBody") + + _request = build_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_purge_status( + self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any + ) -> _models.ComponentPurgeStatusResponse: + """Get status for an ongoing purge operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param purge_id: In a purge status request, this is the Id of the operation the status of which + is returned. Required. + :type purge_id: str + :return: ComponentPurgeStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) + + _request = build_get_purge_status_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + purge_id=purge_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/__init__.py new file mode 100644 index 000000000000..1b67924f17b2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ApplicationInsightsComponent, + ApplicationInsightsComponentListResult, + ComponentPurgeBody, + ComponentPurgeBodyFilters, + ComponentPurgeResponse, + ComponentPurgeStatusResponse, + ComponentsResource, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + PrivateLinkScopedResource, + TagsResource, +) + +from ._application_insights_management_client_enums import ( # type: ignore + ApplicationType, + FlowType, + IngestionMode, + PublicNetworkAccessType, + PurgeState, + RequestSource, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsComponent", + "ApplicationInsightsComponentListResult", + "ComponentPurgeBody", + "ComponentPurgeBodyFilters", + "ComponentPurgeResponse", + "ComponentPurgeStatusResponse", + "ComponentsResource", + "ErrorAdditionalInfo", + "ErrorDetail", + "ErrorResponse", + "PrivateLinkScopedResource", + "TagsResource", + "ApplicationType", + "FlowType", + "IngestionMode", + "PublicNetworkAccessType", + "PurgeState", + "RequestSource", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_application_insights_management_client_enums.py new file mode 100644 index 000000000000..8b3d890ab9d8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_application_insights_management_client_enums.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 ApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of application being monitored.""" + + WEB = "web" + OTHER = "other" + + +class FlowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Used by the Application Insights system to determine what kind of flow this component was + created by. This is to be set to 'Bluefield' when creating/updating a component via the REST + API. + """ + + BLUEFIELD = "Bluefield" + + +class IngestionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the flow of the ingestion.""" + + APPLICATION_INSIGHTS = "ApplicationInsights" + APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS = "ApplicationInsightsWithDiagnosticSettings" + LOG_ANALYTICS = "LogAnalytics" + + +class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The network access type for operating on the Application Insights Component. By default it is + Enabled. + """ + + ENABLED = "Enabled" + """Enables connectivity to Application Insights through public DNS.""" + DISABLED = "Disabled" + """Disables public connectivity to Application Insights through public DNS.""" + + +class PurgeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the operation represented by the requested Id.""" + + PENDING = "pending" + COMPLETED = "completed" + + +class RequestSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes what tool created this Application Insights component. Customers using this API + should set this to the default 'rest'. + """ + + REST = "rest" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_models_py3.py new file mode 100644 index 000000000000..383d911f85b4 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_models_py3.py @@ -0,0 +1,657 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from collections.abc import MutableMapping +import datetime +from typing import Any, Optional, TYPE_CHECKING, Union + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models +JSON = MutableMapping[str, Any] + + +class ComponentsResource(_serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.tags = tags + + +class ApplicationInsightsComponent(ComponentsResource): + """An Application Insights component definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind of application that this component refers to, used to customize UI. This + value is a freeform string, values should typically be one of the following: web, ios, other, + store, java, phone. Required. + :vartype kind: str + :ivar etag: Resource etag. + :vartype etag: str + :ivar application_id: The unique ID of your application. This field mirrors the 'Name' field + and cannot be changed. + :vartype application_id: str + :ivar app_id: Application Insights Unique ID for your Application. + :vartype app_id: str + :ivar name_properties_name: Application name. + :vartype name_properties_name: str + :ivar application_type: Type of application being monitored. Known values are: "web" and + "other". + :vartype application_type: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationType + :ivar flow_type: Used by the Application Insights system to determine what kind of flow this + component was created by. This is to be set to 'Bluefield' when creating/updating a component + via the REST API. "Bluefield" + :vartype flow_type: str or ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.FlowType + :ivar request_source: Describes what tool created this Application Insights component. + Customers using this API should set this to the default 'rest'. "rest" + :vartype request_source: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.RequestSource + :ivar instrumentation_key: Application Insights Instrumentation key. A read-only value that + applications can use to identify the destination for all telemetry sent to Azure Application + Insights. This value will be supplied upon construction of each new Application Insights + component. + :vartype instrumentation_key: str + :ivar creation_date: Creation Date for the Application Insights component, in ISO 8601 format. + :vartype creation_date: ~datetime.datetime + :ivar tenant_id: Azure Tenant Id. + :vartype tenant_id: str + :ivar hockey_app_id: The unique application ID created when a new application is added to + HockeyApp, used for communications with HockeyApp. + :vartype hockey_app_id: str + :ivar hockey_app_token: Token used to authenticate communications with between Application + Insights and HockeyApp. + :vartype hockey_app_token: str + :ivar provisioning_state: Current state of this component: whether or not is has been + provisioned within the resource group it is defined. Users cannot change this value but are + able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + :vartype provisioning_state: str + :ivar sampling_percentage: Percentage of the data produced by the application being monitored + that is being sampled for Application Insights telemetry. + :vartype sampling_percentage: float + :ivar connection_string: Application Insights component connection string. + :vartype connection_string: str + :ivar retention_in_days: Retention period in days. + :vartype retention_in_days: int + :ivar disable_ip_masking: Disable IP masking. + :vartype disable_ip_masking: bool + :ivar immediate_purge_data_on30_days: Purge data immediately after 30 days. + :vartype immediate_purge_data_on30_days: bool + :ivar workspace_resource_id: Resource Id of the log analytics workspace which the data will be + ingested to. This property is required to create an application with this API version. + Applications from older versions will not have this property. + :vartype workspace_resource_id: str + :ivar la_migration_date: The date which the component got migrated to LA, in ISO 8601 format. + :vartype la_migration_date: ~datetime.datetime + :ivar private_link_scoped_resources: List of linked private link scope resources. + :vartype private_link_scoped_resources: + list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PrivateLinkScopedResource] + :ivar public_network_access_for_ingestion: The network access type for accessing Application + Insights ingestion. Known values are: "Enabled" and "Disabled". + :vartype public_network_access_for_ingestion: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PublicNetworkAccessType + :ivar public_network_access_for_query: The network access type for accessing Application + Insights query. Known values are: "Enabled" and "Disabled". + :vartype public_network_access_for_query: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PublicNetworkAccessType + :ivar ingestion_mode: Indicates the flow of the ingestion. Known values are: + "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". + :vartype ingestion_mode: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.IngestionMode + :ivar disable_local_auth: Disable Non-AAD based Auth. + :vartype disable_local_auth: bool + :ivar force_customer_storage_for_profiler: Force users to create their own storage account for + profiler and debugger. + :vartype force_customer_storage_for_profiler: bool + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "kind": {"required": True}, + "application_id": {"readonly": True}, + "app_id": {"readonly": True}, + "name_properties_name": {"readonly": True}, + "instrumentation_key": {"readonly": True}, + "creation_date": {"readonly": True}, + "tenant_id": {"readonly": True}, + "hockey_app_token": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "connection_string": {"readonly": True}, + "retention_in_days": {"readonly": True}, + "la_migration_date": {"readonly": True}, + "private_link_scoped_resources": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kind": {"key": "kind", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "application_id": {"key": "properties.ApplicationId", "type": "str"}, + "app_id": {"key": "properties.AppId", "type": "str"}, + "name_properties_name": {"key": "properties.Name", "type": "str"}, + "application_type": {"key": "properties.Application_Type", "type": "str"}, + "flow_type": {"key": "properties.Flow_Type", "type": "str"}, + "request_source": {"key": "properties.Request_Source", "type": "str"}, + "instrumentation_key": {"key": "properties.InstrumentationKey", "type": "str"}, + "creation_date": {"key": "properties.CreationDate", "type": "iso-8601"}, + "tenant_id": {"key": "properties.TenantId", "type": "str"}, + "hockey_app_id": {"key": "properties.HockeyAppId", "type": "str"}, + "hockey_app_token": {"key": "properties.HockeyAppToken", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "sampling_percentage": {"key": "properties.SamplingPercentage", "type": "float"}, + "connection_string": {"key": "properties.ConnectionString", "type": "str"}, + "retention_in_days": {"key": "properties.RetentionInDays", "type": "int"}, + "disable_ip_masking": {"key": "properties.DisableIpMasking", "type": "bool"}, + "immediate_purge_data_on30_days": {"key": "properties.ImmediatePurgeDataOn30Days", "type": "bool"}, + "workspace_resource_id": {"key": "properties.WorkspaceResourceId", "type": "str"}, + "la_migration_date": {"key": "properties.LaMigrationDate", "type": "iso-8601"}, + "private_link_scoped_resources": { + "key": "properties.PrivateLinkScopedResources", + "type": "[PrivateLinkScopedResource]", + }, + "public_network_access_for_ingestion": {"key": "properties.publicNetworkAccessForIngestion", "type": "str"}, + "public_network_access_for_query": {"key": "properties.publicNetworkAccessForQuery", "type": "str"}, + "ingestion_mode": {"key": "properties.IngestionMode", "type": "str"}, + "disable_local_auth": {"key": "properties.DisableLocalAuth", "type": "bool"}, + "force_customer_storage_for_profiler": {"key": "properties.ForceCustomerStorageForProfiler", "type": "bool"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + location: str, + kind: str, + tags: Optional[dict[str, str]] = None, + etag: Optional[str] = None, + application_type: Union[str, "_models.ApplicationType"] = "web", + flow_type: Union[str, "_models.FlowType"] = "Bluefield", + request_source: Union[str, "_models.RequestSource"] = "rest", + hockey_app_id: Optional[str] = None, + sampling_percentage: Optional[float] = None, + disable_ip_masking: Optional[bool] = None, + immediate_purge_data_on30_days: Optional[bool] = None, + workspace_resource_id: Optional[str] = None, + public_network_access_for_ingestion: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", + public_network_access_for_query: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", + ingestion_mode: Union[str, "_models.IngestionMode"] = "LogAnalytics", + disable_local_auth: Optional[bool] = None, + force_customer_storage_for_profiler: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword kind: The kind of application that this component refers to, used to customize UI. + This value is a freeform string, values should typically be one of the following: web, ios, + other, store, java, phone. Required. + :paramtype kind: str + :keyword etag: Resource etag. + :paramtype etag: str + :keyword application_type: Type of application being monitored. Known values are: "web" and + "other". + :paramtype application_type: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationType + :keyword flow_type: Used by the Application Insights system to determine what kind of flow this + component was created by. This is to be set to 'Bluefield' when creating/updating a component + via the REST API. "Bluefield" + :paramtype flow_type: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.FlowType + :keyword request_source: Describes what tool created this Application Insights component. + Customers using this API should set this to the default 'rest'. "rest" + :paramtype request_source: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.RequestSource + :keyword hockey_app_id: The unique application ID created when a new application is added to + HockeyApp, used for communications with HockeyApp. + :paramtype hockey_app_id: str + :keyword sampling_percentage: Percentage of the data produced by the application being + monitored that is being sampled for Application Insights telemetry. + :paramtype sampling_percentage: float + :keyword disable_ip_masking: Disable IP masking. + :paramtype disable_ip_masking: bool + :keyword immediate_purge_data_on30_days: Purge data immediately after 30 days. + :paramtype immediate_purge_data_on30_days: bool + :keyword workspace_resource_id: Resource Id of the log analytics workspace which the data will + be ingested to. This property is required to create an application with this API version. + Applications from older versions will not have this property. + :paramtype workspace_resource_id: str + :keyword public_network_access_for_ingestion: The network access type for accessing Application + Insights ingestion. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access_for_ingestion: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PublicNetworkAccessType + :keyword public_network_access_for_query: The network access type for accessing Application + Insights query. Known values are: "Enabled" and "Disabled". + :paramtype public_network_access_for_query: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PublicNetworkAccessType + :keyword ingestion_mode: Indicates the flow of the ingestion. Known values are: + "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". + :paramtype ingestion_mode: str or + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.IngestionMode + :keyword disable_local_auth: Disable Non-AAD based Auth. + :paramtype disable_local_auth: bool + :keyword force_customer_storage_for_profiler: Force users to create their own storage account + for profiler and debugger. + :paramtype force_customer_storage_for_profiler: bool + """ + super().__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.etag = etag + self.application_id: Optional[str] = None + self.app_id: Optional[str] = None + self.name_properties_name: Optional[str] = None + self.application_type = application_type + self.flow_type = flow_type + self.request_source = request_source + self.instrumentation_key: Optional[str] = None + self.creation_date: Optional[datetime.datetime] = None + self.tenant_id: Optional[str] = None + self.hockey_app_id = hockey_app_id + self.hockey_app_token: Optional[str] = None + self.provisioning_state: Optional[str] = None + self.sampling_percentage = sampling_percentage + self.connection_string: Optional[str] = None + self.retention_in_days: Optional[int] = None + self.disable_ip_masking = disable_ip_masking + self.immediate_purge_data_on30_days = immediate_purge_data_on30_days + self.workspace_resource_id = workspace_resource_id + self.la_migration_date: Optional[datetime.datetime] = None + self.private_link_scoped_resources: Optional[list["_models.PrivateLinkScopedResource"]] = None + self.public_network_access_for_ingestion = public_network_access_for_ingestion + self.public_network_access_for_query = public_network_access_for_query + self.ingestion_mode = ingestion_mode + self.disable_local_auth = disable_local_auth + self.force_customer_storage_for_profiler = force_customer_storage_for_profiler + + +class ApplicationInsightsComponentListResult(_serialization.Model): + """Describes the list of Application Insights Resources. + + All required parameters must be populated in order to send to server. + + :ivar value: List of Application Insights component definitions. Required. + :vartype value: + list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] + :ivar next_link: The URI to get the next set of Application Insights component definitions if + too many components where returned in the result set. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ApplicationInsightsComponent]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: list["_models.ApplicationInsightsComponent"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of Application Insights component definitions. Required. + :paramtype value: + list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] + :keyword next_link: The URI to get the next set of Application Insights component definitions + if too many components where returned in the result set. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ComponentPurgeBody(_serialization.Model): + """Describes the body of a purge request for an App Insights component. + + All required parameters must be populated in order to send to server. + + :ivar table: Table from which to purge data. Required. + :vartype table: str + :ivar filters: The set of columns and filters (queries) to run over them to purge the resulting + data. Required. + :vartype filters: + list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBodyFilters] + """ + + _validation = { + "table": {"required": True}, + "filters": {"required": True}, + } + + _attribute_map = { + "table": {"key": "table", "type": "str"}, + "filters": {"key": "filters", "type": "[ComponentPurgeBodyFilters]"}, + } + + def __init__(self, *, table: str, filters: list["_models.ComponentPurgeBodyFilters"], **kwargs: Any) -> None: + """ + :keyword table: Table from which to purge data. Required. + :paramtype table: str + :keyword filters: The set of columns and filters (queries) to run over them to purge the + resulting data. Required. + :paramtype filters: + list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBodyFilters] + """ + super().__init__(**kwargs) + self.table = table + self.filters = filters + + +class ComponentPurgeBodyFilters(_serialization.Model): + """User-defined filters to return data which will be purged from the table. + + :ivar column: The column of the table over which the given query should run. + :vartype column: str + :ivar operator: A query operator to evaluate over the provided column and value(s). Supported + operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would + in a KQL query. + :vartype operator: str + :ivar value: the value for the operator to function over. This can be a number (e.g., > 100), a + string (timestamp >= '2017-09-01') or array of values. + :vartype value: any + :ivar key: When filtering over custom dimensions, this key will be used as the name of the + custom dimension. + :vartype key: str + """ + + _attribute_map = { + "column": {"key": "column", "type": "str"}, + "operator": {"key": "operator", "type": "str"}, + "value": {"key": "value", "type": "object"}, + "key": {"key": "key", "type": "str"}, + } + + def __init__( + self, + *, + column: Optional[str] = None, + operator: Optional[str] = None, + value: Optional[Any] = None, + key: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword column: The column of the table over which the given query should run. + :paramtype column: str + :keyword operator: A query operator to evaluate over the provided column and value(s). + Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as + they would in a KQL query. + :paramtype operator: str + :keyword value: the value for the operator to function over. This can be a number (e.g., > + 100), a string (timestamp >= '2017-09-01') or array of values. + :paramtype value: any + :keyword key: When filtering over custom dimensions, this key will be used as the name of the + custom dimension. + :paramtype key: str + """ + super().__init__(**kwargs) + self.column = column + self.operator = operator + self.value = value + self.key = key + + +class ComponentPurgeResponse(_serialization.Model): + """Response containing operationId for a specific purge action. + + All required parameters must be populated in order to send to server. + + :ivar operation_id: Id to use when querying for status for a particular purge operation. + Required. + :vartype operation_id: str + """ + + _validation = { + "operation_id": {"required": True}, + } + + _attribute_map = { + "operation_id": {"key": "operationId", "type": "str"}, + } + + def __init__(self, *, operation_id: str, **kwargs: Any) -> None: + """ + :keyword operation_id: Id to use when querying for status for a particular purge operation. + Required. + :paramtype operation_id: str + """ + super().__init__(**kwargs) + self.operation_id = operation_id + + +class ComponentPurgeStatusResponse(_serialization.Model): + """Response containing status for a specific purge operation. + + All required parameters must be populated in order to send to server. + + :ivar status: Status of the operation represented by the requested Id. Required. Known values + are: "pending" and "completed". + :vartype status: str or ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PurgeState + """ + + _validation = { + "status": {"required": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__(self, *, status: Union[str, "_models.PurgeState"], **kwargs: Any) -> None: + """ + :keyword status: Status of the operation represented by the requested Id. Required. Known + values are: "pending" and "completed". + :paramtype status: str or ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PurgeState + """ + super().__init__(**kwargs) + self.status = status + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + self.info: Optional[JSON] = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[list["_models.ErrorDetail"]] = None + self.additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class PrivateLinkScopedResource(_serialization.Model): + """The private link scope resource reference. + + :ivar resource_id: The full resource Id of the private link scope resource. + :vartype resource_id: str + :ivar scope_id: The private link scope unique Identifier. + :vartype scope_id: str + """ + + _attribute_map = { + "resource_id": {"key": "ResourceId", "type": "str"}, + "scope_id": {"key": "ScopeId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, scope_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The full resource Id of the private link scope resource. + :paramtype resource_id: str + :keyword scope_id: The private link scope unique Identifier. + :paramtype scope_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.scope_id = scope_id + + +class TagsResource(_serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on a + WebTest instance. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/__init__.py new file mode 100644 index 000000000000..ab50c30fbaac --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._components_operations import ComponentsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComponentsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_components_operations.py new file mode 100644 index 000000000000..50950fb0869c --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_components_operations.py @@ -0,0 +1,1101 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components") + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, 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", "2020-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, 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", "2020-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, 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", "2020-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_tags_request( + resource_group_name: str, 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", "2020-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_purge_request( + resource_group_name: str, 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", "2020-02-02-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_purge_status_request( + resource_group_name: str, resource_name: str, purge_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", "2020-02-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2020_02_02_preview.ApplicationInsightsManagementClient`'s + :attr:`components` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of all Application Insights components within a subscription. + + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of Application Insights components within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of either ApplicationInsightsComponent or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApplicationInsightsComponentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ApplicationInsightsComponent: + """Returns an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: _models.ApplicationInsightsComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. + Required. + :type insight_properties: + ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent or + IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(insight_properties, (IOBase, bytes)): + _content = insight_properties + else: + _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: Union[_models.TagsResource, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Is either a + TagsResource type or a IO[bytes] type. Required. + :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.TagsResource + or IO[bytes] + :return: ApplicationInsightsComponent or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(component_tags, (IOBase, bytes)): + _content = component_tags + else: + _json = self._serialize.body(component_tags, "TagsResource") + + _request = build_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def purge( + self, + resource_group_name: str, + resource_name: str, + body: _models.ComponentPurgeBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def purge( + self, + resource_group_name: str, + resource_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def purge( + self, + resource_group_name: str, + resource_name: str, + body: Union[_models.ComponentPurgeBody, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBody or + IO[bytes] + :return: ComponentPurgeResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ComponentPurgeBody") + + _request = build_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_purge_status( + self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any + ) -> _models.ComponentPurgeStatusResponse: + """Get status for an ongoing purge operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param purge_id: In a purge status request, this is the Id of the operation the status of which + is returned. Required. + :type purge_id: str + :return: ComponentPurgeStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) + + _request = build_get_purge_status_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + purge_id=purge_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponse, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_application_insights_management_client.py new file mode 100644 index 000000000000..bccc8674ffca --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_application_insights_management_client.py @@ -0,0 +1,130 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import ComponentLinkedStorageAccountsOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar component_linked_storage_accounts: ComponentLinkedStorageAccountsOperations operations + :vartype component_linked_storage_accounts: + azure.mgmt.applicationinsights.v2020_03_01_preview.operations.ComponentLinkedStorageAccountsOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-03-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.component_linked_storage_accounts = ComponentLinkedStorageAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_configuration.py new file mode 100644 index 000000000000..a499beec345b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-03-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, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2020-03-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..e89a4a0fd39b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_application_insights_management_client.py @@ -0,0 +1,134 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import ComponentLinkedStorageAccountsOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar component_linked_storage_accounts: ComponentLinkedStorageAccountsOperations operations + :vartype component_linked_storage_accounts: + azure.mgmt.applicationinsights.v2020_03_01_preview.aio.operations.ComponentLinkedStorageAccountsOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-03-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.component_linked_storage_accounts = ComponentLinkedStorageAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..79032cafee72 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-03-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, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2020-03-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..674336f5dd75 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._component_linked_storage_accounts_operations import ComponentLinkedStorageAccountsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComponentLinkedStorageAccountsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_linked_storage_accounts_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_component_linked_storage_accounts_operations.py similarity index 86% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_linked_storage_accounts_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_component_linked_storage_accounts_operations.py index 583d12941db3..be8131fbaecc 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_component_linked_storage_accounts_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_component_linked_storage_accounts_operations.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -35,7 +35,7 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] class ComponentLinkedStorageAccountsOperations: @@ -44,7 +44,7 @@ class ComponentLinkedStorageAccountsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2020_03_01_preview.aio.ApplicationInsightsManagementClient`'s :attr:`component_linked_storage_accounts` attribute. """ @@ -72,9 +72,11 @@ async def get( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -88,7 +90,7 @@ 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", "2020-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) _request = build_get_request( @@ -111,7 +113,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseLinkedStorage, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) @@ -141,16 +146,18 @@ async def create_and_update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update linked storage accounts for an Application Insights component. Required. :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ @@ -174,7 +181,8 @@ async def create_and_update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update linked storage accounts for an Application Insights component. Required. :type linked_storage_accounts_properties: IO[bytes] @@ -182,7 +190,8 @@ async def create_and_update( Default value is "application/json". :paramtype content_type: str :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ @@ -204,14 +213,17 @@ async def create_and_update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update linked storage accounts for an Application Insights component. Is either a ComponentLinkedStorageAccounts type or a IO[bytes] type. Required. :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts or IO[bytes] + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts or + IO[bytes] :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -225,7 +237,7 @@ async def create_and_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) @@ -260,7 +272,10 @@ async def create_and_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseLinkedStorage, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) @@ -290,16 +305,18 @@ async def update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update a linked storage accounts for an Application Insights component. Required. :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccountsPatch + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccountsPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ @@ -323,7 +340,8 @@ async def update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update a linked storage accounts for an Application Insights component. Required. :type linked_storage_accounts_properties: IO[bytes] @@ -331,7 +349,8 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ @@ -353,14 +372,17 @@ async def update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update a linked storage accounts for an Application Insights component. Is either a ComponentLinkedStorageAccountsPatch type or a IO[bytes] type. Required. :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccountsPatch or IO[bytes] + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccountsPatch + or IO[bytes] :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -374,7 +396,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) @@ -409,7 +431,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseLinkedStorage, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) @@ -432,7 +457,8 @@ async def delete( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -448,7 +474,7 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -471,7 +497,10 @@ async def delete( if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseLinkedStorage, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/__init__.py new file mode 100644 index 000000000000..5289496d8064 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ComponentLinkedStorageAccounts, + ComponentLinkedStorageAccountsPatch, + ErrorResponseLinkedStorage, + ErrorResponseLinkedStorageError, + ProxyResource, + Resource, +) + +from ._application_insights_management_client_enums import ( # type: ignore + StorageType, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComponentLinkedStorageAccounts", + "ComponentLinkedStorageAccountsPatch", + "ErrorResponseLinkedStorage", + "ErrorResponseLinkedStorageError", + "ProxyResource", + "Resource", + "StorageType", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_application_insights_management_client_enums.py new file mode 100644 index 000000000000..a33a8a879fb3 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_application_insights_management_client_enums.py @@ -0,0 +1,16 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """StorageType.""" + + SERVICE_PROFILER = "ServiceProfiler" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..9d2109f0a7c5 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_models_py3.py @@ -0,0 +1,179 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models + + +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: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = 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 + """ + + +class ComponentLinkedStorageAccounts(ProxyResource): + """An Application Insights component linked storage accounts. + + 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 linked_storage_account: Linked storage account resource ID. + :vartype linked_storage_account: 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"}, + "linked_storage_account": {"key": "properties.linkedStorageAccount", "type": "str"}, + } + + def __init__(self, *, linked_storage_account: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword linked_storage_account: Linked storage account resource ID. + :paramtype linked_storage_account: str + """ + super().__init__(**kwargs) + self.linked_storage_account = linked_storage_account + + +class ComponentLinkedStorageAccountsPatch(_serialization.Model): + """An Application Insights component linked storage accounts patch. + + :ivar linked_storage_account: Linked storage account resource ID. + :vartype linked_storage_account: str + """ + + _attribute_map = { + "linked_storage_account": {"key": "properties.linkedStorageAccount", "type": "str"}, + } + + def __init__(self, *, linked_storage_account: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword linked_storage_account: Linked storage account resource ID. + :paramtype linked_storage_account: str + """ + super().__init__(**kwargs) + self.linked_storage_account = linked_storage_account + + +class ErrorResponseLinkedStorage(_serialization.Model): + """ErrorResponseLinkedStorage. + + :ivar error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :vartype error: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ErrorResponseLinkedStorageError + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorResponseLinkedStorageError"}, + } + + def __init__(self, *, error: Optional["_models.ErrorResponseLinkedStorageError"] = None, **kwargs: Any) -> None: + """ + :keyword error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :paramtype error: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ErrorResponseLinkedStorageError + """ + super().__init__(**kwargs) + self.error = error + + +class ErrorResponseLinkedStorageError(_serialization.Model): + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/__init__.py new file mode 100644 index 000000000000..674336f5dd75 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._component_linked_storage_accounts_operations import ComponentLinkedStorageAccountsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ComponentLinkedStorageAccountsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_linked_storage_accounts_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_component_linked_storage_accounts_operations.py similarity index 89% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_linked_storage_accounts_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_component_linked_storage_accounts_operations.py index 8156d2eaf6f1..9e9c30d85601 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_component_linked_storage_accounts_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_component_linked_storage_accounts_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload from azure.core import PipelineClient from azure.core.exceptions import ( @@ -30,7 +30,7 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -200,7 +200,7 @@ class ComponentLinkedStorageAccountsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2020_03_01_preview.ApplicationInsightsManagementClient`'s :attr:`component_linked_storage_accounts` attribute. """ @@ -228,9 +228,11 @@ def get( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -244,7 +246,7 @@ 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", "2020-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) _request = build_get_request( @@ -267,7 +269,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseLinkedStorage, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) @@ -297,16 +302,18 @@ def create_and_update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update linked storage accounts for an Application Insights component. Required. :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ @@ -330,7 +337,8 @@ def create_and_update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update linked storage accounts for an Application Insights component. Required. :type linked_storage_accounts_properties: IO[bytes] @@ -338,7 +346,8 @@ def create_and_update( Default value is "application/json". :paramtype content_type: str :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ @@ -360,14 +369,17 @@ def create_and_update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update linked storage accounts for an Application Insights component. Is either a ComponentLinkedStorageAccounts type or a IO[bytes] type. Required. :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts or IO[bytes] + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts or + IO[bytes] :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -381,7 +393,7 @@ def create_and_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) @@ -416,7 +428,10 @@ def create_and_update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseLinkedStorage, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) @@ -446,16 +461,18 @@ def update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update a linked storage accounts for an Application Insights component. Required. :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccountsPatch + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccountsPatch :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ @@ -479,7 +496,8 @@ def update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update a linked storage accounts for an Application Insights component. Required. :type linked_storage_accounts_properties: IO[bytes] @@ -487,7 +505,8 @@ def update( Default value is "application/json". :paramtype content_type: str :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ @@ -509,14 +528,17 @@ def update( :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :param linked_storage_accounts_properties: Properties that need to be specified to update a linked storage accounts for an Application Insights component. Is either a ComponentLinkedStorageAccountsPatch type or a IO[bytes] type. Required. :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccountsPatch or IO[bytes] + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccountsPatch + or IO[bytes] :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :rtype: + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -530,7 +552,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) @@ -565,7 +587,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseLinkedStorage, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) @@ -588,7 +613,8 @@ def delete( # pylint: disable=inconsistent-return-statements :type resource_name: str :param storage_type: The type of the Application Insights component data source for the linked storage account. "ServiceProfiler" Required. - :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :type storage_type: str or + ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -604,7 +630,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -627,7 +653,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseLinkedStorage, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_application_insights_management_client.py new file mode 100644 index 000000000000..691a5c968f81 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_application_insights_management_client.py @@ -0,0 +1,124 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import LiveTokenOperations, Operations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.applicationinsights.v2020_06_02_preview.operations.Operations + :ivar live_token: LiveTokenOperations operations + :vartype live_token: + azure.mgmt.applicationinsights.v2020_06_02_preview.operations.LiveTokenOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param base_url: Service URL. Default value is None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-06-02-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_configuration.py new file mode 100644 index 000000000000..15231ed11942 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_configuration.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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-06-02-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, credential: "TokenCredential", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2020-06-02-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + self.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..d71572daed5d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_application_insights_management_client.py @@ -0,0 +1,129 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import LiveTokenOperations, Operations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar operations: Operations operations + :vartype operations: + azure.mgmt.applicationinsights.v2020_06_02_preview.aio.operations.Operations + :ivar live_token: LiveTokenOperations operations + :vartype live_token: + azure.mgmt.applicationinsights.v2020_06_02_preview.aio.operations.LiveTokenOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param base_url: Service URL. Default value is None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-06-02-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_configuration.py new file mode 100644 index 000000000000..8248239c8ca2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_configuration.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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-06-02-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, credential: "AsyncTokenCredential", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2020-06-02-preview") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + self.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..a0f09b210fc1 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._live_token_operations import LiveTokenOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "LiveTokenOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_live_token_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_live_token_operations.py new file mode 100644 index 000000000000..2e34a471f3d8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_live_token_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._live_token_operations import build_get_request +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class LiveTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2020_06_02_preview.aio.ApplicationInsightsManagementClient`'s + :attr:`live_token` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: + """**Gets an access token for live metrics stream data.**. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :return: LiveTokenResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.LiveTokenResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LiveTokenResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..ee36bfc89adf --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_operations.py @@ -0,0 +1,134 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import build_list_request +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2020_06_02_preview.aio.ApplicationInsightsManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.OperationLive"]: + """List available operations. + + List the available operations supported by the resource provider. + + :return: An iterator like instance of either OperationLive or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationLive] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationsListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/__init__.py new file mode 100644 index 000000000000..04eb8d951dbb --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/__init__.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ErrorResponseLinkedStorage, + ErrorResponseLinkedStorageError, + LiveTokenResponse, + OperationInfo, + OperationLive, + OperationsListResult, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ErrorResponseLinkedStorage", + "ErrorResponseLinkedStorageError", + "LiveTokenResponse", + "OperationInfo", + "OperationLive", + "OperationsListResult", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_models_py3.py new file mode 100644 index 000000000000..63c5297a8528 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_models_py3.py @@ -0,0 +1,213 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from collections.abc import MutableMapping +from typing import Any, Optional, TYPE_CHECKING + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models +JSON = MutableMapping[str, Any] + + +class ErrorResponseLinkedStorage(_serialization.Model): + """ErrorResponseLinkedStorage. + + :ivar error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :vartype error: + ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.ErrorResponseLinkedStorageError + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorResponseLinkedStorageError"}, + } + + def __init__(self, *, error: Optional["_models.ErrorResponseLinkedStorageError"] = None, **kwargs: Any) -> None: + """ + :keyword error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :paramtype error: + ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.ErrorResponseLinkedStorageError + """ + super().__init__(**kwargs) + self.error = error + + +class ErrorResponseLinkedStorageError(_serialization.Model): + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None + + +class LiveTokenResponse(_serialization.Model): + """The response to a live token query. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar live_token: JWT token for accessing live metrics stream data. + :vartype live_token: str + """ + + _validation = { + "live_token": {"readonly": True}, + } + + _attribute_map = { + "live_token": {"key": "liveToken", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.live_token: Optional[str] = None + + +class OperationInfo(_serialization.Model): + """Information about an operation. + + :ivar provider: Name of the provider. + :vartype provider: str + :ivar resource: Name of the resource type. + :vartype resource: str + :ivar operation: Name of the operation. + :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: Name of the provider. + :paramtype provider: str + :keyword resource: Name of the resource type. + :paramtype resource: str + :keyword operation: Name of the operation. + :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 OperationLive(_serialization.Model): + """Represents an operation returned by the GetOperations request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Display name of the operation. + :vartype display: ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationInfo + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: JSON + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationInfo"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.OperationInfo"] = None, + origin: Optional[str] = None, + properties: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Display name of the operation. + :paramtype display: ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationInfo + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: JSON + """ + super().__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.properties = properties + + +class OperationsListResult(_serialization.Model): + """Result of the List Operations operation. + + :ivar value: A collection of operations. + :vartype value: list[~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationLive] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[OperationLive]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[list["_models.OperationLive"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A collection of operations. + :paramtype value: + list[~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationLive] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/__init__.py new file mode 100644 index 000000000000..a0f09b210fc1 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._live_token_operations import LiveTokenOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "LiveTokenOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_live_token_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_live_token_operations.py new file mode 100644 index 000000000000..14e6e0d83d7d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_live_token_operations.py @@ -0,0 +1,135 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_uri: 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", "2020-06-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/generatelivetoken") + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class LiveTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2020_06_02_preview.ApplicationInsightsManagementClient`'s + :attr:`live_token` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: + """**Gets an access token for live metrics stream data.**. + + :param resource_uri: The identifier of the resource. Required. + :type resource_uri: str + :return: LiveTokenResponse or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.LiveTokenResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LiveTokenResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_operations.py new file mode 100644 index 000000000000..f5fe8035def0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_operations.py @@ -0,0 +1,154 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-06-02-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/microsoft.insights/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.applicationinsights.v2020_06_02_preview.ApplicationInsightsManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.OperationLive"]: + """List available operations. + + List the available operations supported by the resource provider. + + :return: An iterator like instance of either OperationLive or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationLive] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationsListResult", 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_application_insights_management_client.py new file mode 100644 index 000000000000..8bf4b12ceb58 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_application_insights_management_client.py @@ -0,0 +1,130 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import WorkbookTemplatesOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar workbook_templates: WorkbookTemplatesOperations operations + :vartype workbook_templates: + azure.mgmt.applicationinsights.v2020_11_20.operations.WorkbookTemplatesOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-11-20". 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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.workbook_templates = WorkbookTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_configuration.py new file mode 100644 index 000000000000..991ac104de48 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-11-20". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2020-11-20") + + 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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..980d46a5c9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_application_insights_management_client.py @@ -0,0 +1,134 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import WorkbookTemplatesOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar workbook_templates: WorkbookTemplatesOperations operations + :vartype workbook_templates: + azure.mgmt.applicationinsights.v2020_11_20.aio.operations.WorkbookTemplatesOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-11-20". 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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.workbook_templates = WorkbookTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_configuration.py new file mode 100644 index 000000000000..e85cc6bdc99b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2020-11-20". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2020-11-20") + + 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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/__init__.py new file mode 100644 index 000000000000..aa730bc20e57 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._workbook_templates_operations import WorkbookTemplatesOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbookTemplatesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_workbook_templates_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_workbook_templates_operations.py similarity index 86% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_workbook_templates_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_workbook_templates_operations.py index 9bbe4554f5c2..63a0fcace888 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_workbook_templates_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_workbook_templates_operations.py @@ -7,7 +7,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,7 +39,7 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] class WorkbookTemplatesOperations: @@ -47,7 +48,7 @@ class WorkbookTemplatesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2020_11_20.aio.ApplicationInsightsManagementClient`'s :attr:`workbook_templates` attribute. """ @@ -73,13 +74,13 @@ def list_by_resource_group( :type resource_group_name: str :return: An iterator like instance of either WorkbookTemplate or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.WorkbookTemplate] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate] :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", "2020-11-20")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -103,7 +104,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -126,7 +138,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookTemplateError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookTemplateError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -143,7 +158,7 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -157,7 +172,7 @@ async def get(self, resource_group_name: str, 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", "2020-11-20")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) _request = build_get_request( @@ -179,7 +194,10 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookTemplateError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookTemplateError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) @@ -213,7 +231,7 @@ async def delete(self, resource_group_name: str, resource_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -235,7 +253,10 @@ async def delete(self, resource_group_name: str, resource_name: str, **kwargs: A if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookTemplateError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookTemplateError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -260,12 +281,13 @@ async def create_or_update( :type resource_name: str :param workbook_template_properties: Properties that need to be specified to create a new workbook. Required. - :type workbook_template_properties: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :type workbook_template_properties: + ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ @@ -293,7 +315,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ @@ -314,10 +336,10 @@ async def create_or_update( :type resource_name: str :param workbook_template_properties: Properties that need to be specified to create a new workbook. Is either a WorkbookTemplate type or a IO[bytes] type. Required. - :type workbook_template_properties: ~azure.mgmt.applicationinsights.models.WorkbookTemplate or - IO[bytes] + :type workbook_template_properties: + ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate or IO[bytes] :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -331,7 +353,7 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) @@ -365,7 +387,10 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookTemplateError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookTemplateError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) @@ -395,12 +420,12 @@ async def update( :param workbook_template_update_parameters: Properties that need to be specified to patch a workbook template. Default value is None. :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.models.WorkbookTemplateUpdateParameters + ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ @@ -428,7 +453,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ @@ -453,9 +478,10 @@ async def update( workbook template. Is either a WorkbookTemplateUpdateParameters type or a IO[bytes] type. Default value is None. :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.models.WorkbookTemplateUpdateParameters or IO[bytes] + ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateUpdateParameters or + IO[bytes] :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -469,11 +495,12 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_template_update_parameters else None cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if workbook_template_update_parameters else None _json = None _content = None if isinstance(workbook_template_update_parameters, (IOBase, bytes)): @@ -506,7 +533,10 @@ async def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookTemplateError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookTemplateError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/__init__.py new file mode 100644 index 000000000000..9bfd87c9013b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/__init__.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + WorkbookTemplate, + WorkbookTemplateError, + WorkbookTemplateErrorBody, + WorkbookTemplateErrorFieldContract, + WorkbookTemplateGallery, + WorkbookTemplateLocalizedGallery, + WorkbookTemplateResource, + WorkbookTemplateUpdateParameters, + WorkbookTemplatesListResult, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbookTemplate", + "WorkbookTemplateError", + "WorkbookTemplateErrorBody", + "WorkbookTemplateErrorFieldContract", + "WorkbookTemplateGallery", + "WorkbookTemplateLocalizedGallery", + "WorkbookTemplateResource", + "WorkbookTemplateUpdateParameters", + "WorkbookTemplatesListResult", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_models_py3.py new file mode 100644 index 000000000000..dc08eeb5f3b0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_models_py3.py @@ -0,0 +1,430 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from collections.abc import MutableMapping +from typing import Any, Optional, TYPE_CHECKING + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models +JSON = MutableMapping[str, Any] + + +class WorkbookTemplateResource(_serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.tags = tags + + +class WorkbookTemplate(WorkbookTemplateResource): + """An Application Insights workbook template definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar priority: Priority of the template. Determines which template to open when a workbook + gallery is opened in viewer mode. + :vartype priority: int + :ivar author: Information about the author of the workbook template. + :vartype author: str + :ivar template_data: Valid JSON object containing workbook template payload. + :vartype template_data: JSON + :ivar galleries: Workbook galleries supported by the template. + :vartype galleries: + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] + :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages + supported by the Azure portal. + :vartype localized: dict[str, + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateLocalizedGallery]] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "priority": {"key": "properties.priority", "type": "int"}, + "author": {"key": "properties.author", "type": "str"}, + "template_data": {"key": "properties.templateData", "type": "object"}, + "galleries": {"key": "properties.galleries", "type": "[WorkbookTemplateGallery]"}, + "localized": {"key": "properties.localized", "type": "{[WorkbookTemplateLocalizedGallery]}"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + priority: Optional[int] = None, + author: Optional[str] = None, + template_data: Optional[JSON] = None, + galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, + localized: Optional[dict[str, list["_models.WorkbookTemplateLocalizedGallery"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword priority: Priority of the template. Determines which template to open when a workbook + gallery is opened in viewer mode. + :paramtype priority: int + :keyword author: Information about the author of the workbook template. + :paramtype author: str + :keyword template_data: Valid JSON object containing workbook template payload. + :paramtype template_data: JSON + :keyword galleries: Workbook galleries supported by the template. + :paramtype galleries: + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] + :keyword localized: Key value pair of localized gallery. Each key is the locale code of + languages supported by the Azure portal. + :paramtype localized: dict[str, + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateLocalizedGallery]] + """ + super().__init__(location=location, tags=tags, **kwargs) + self.priority = priority + self.author = author + self.template_data = template_data + self.galleries = galleries + self.localized = localized + + +class WorkbookTemplateError(_serialization.Model): + """Error message that will indicate why the operation failed. + + :ivar error: Error message object that will indicate why the operation failed. + :vartype error: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateErrorBody + """ + + _attribute_map = { + "error": {"key": "error", "type": "WorkbookTemplateErrorBody"}, + } + + def __init__(self, *, error: Optional["_models.WorkbookTemplateErrorBody"] = None, **kwargs: Any) -> None: + """ + :keyword error: Error message object that will indicate why the operation failed. + :paramtype error: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateErrorBody + """ + super().__init__(**kwargs) + self.error = error + + +class WorkbookTemplateErrorBody(_serialization.Model): + """Error message body that will indicate why the operation failed. + + :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar details: The list of invalid fields send in request, in case of validation error. + :vartype details: + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateErrorFieldContract] + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "details": {"key": "details", "type": "[WorkbookTemplateErrorFieldContract]"}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + details: Optional[list["_models.WorkbookTemplateErrorFieldContract"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :paramtype code: str + :keyword message: Human-readable representation of the error. + :paramtype message: str + :keyword details: The list of invalid fields send in request, in case of validation error. + :paramtype details: + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateErrorFieldContract] + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.details = details + + +class WorkbookTemplateErrorFieldContract(_serialization.Model): + """Error Field contract. + + :ivar code: Property level error code. + :vartype code: str + :ivar message: Human-readable representation of property-level error. + :vartype message: str + :ivar target: Property name. + :vartype target: str + """ + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + } + + def __init__( + self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword code: Property level error code. + :paramtype code: str + :keyword message: Human-readable representation of property-level error. + :paramtype message: str + :keyword target: Property name. + :paramtype target: str + """ + super().__init__(**kwargs) + self.code = code + self.message = message + self.target = target + + +class WorkbookTemplateGallery(_serialization.Model): + """Gallery information for a workbook template. + + :ivar name: Name of the workbook template in the gallery. + :vartype name: str + :ivar category: Category for the gallery. + :vartype category: str + :ivar type: Type of workbook supported by the workbook template. + :vartype type: str + :ivar order: Order of the template within the gallery. + :vartype order: int + :ivar resource_type: Azure resource type supported by the gallery. + :vartype resource_type: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "order": {"key": "order", "type": "int"}, + "resource_type": {"key": "resourceType", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + category: Optional[str] = None, + type: Optional[str] = None, + order: Optional[int] = None, + resource_type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the workbook template in the gallery. + :paramtype name: str + :keyword category: Category for the gallery. + :paramtype category: str + :keyword type: Type of workbook supported by the workbook template. + :paramtype type: str + :keyword order: Order of the template within the gallery. + :paramtype order: int + :keyword resource_type: Azure resource type supported by the gallery. + :paramtype resource_type: str + """ + super().__init__(**kwargs) + self.name = name + self.category = category + self.type = type + self.order = order + self.resource_type = resource_type + + +class WorkbookTemplateLocalizedGallery(_serialization.Model): + """Localized template data and gallery information. + + :ivar template_data: Valid JSON object containing workbook template payload. + :vartype template_data: JSON + :ivar galleries: Workbook galleries supported by the template. + :vartype galleries: + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] + """ + + _attribute_map = { + "template_data": {"key": "templateData", "type": "object"}, + "galleries": {"key": "galleries", "type": "[WorkbookTemplateGallery]"}, + } + + def __init__( + self, + *, + template_data: Optional[JSON] = None, + galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword template_data: Valid JSON object containing workbook template payload. + :paramtype template_data: JSON + :keyword galleries: Workbook galleries supported by the template. + :paramtype galleries: + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] + """ + super().__init__(**kwargs) + self.template_data = template_data + self.galleries = galleries + + +class WorkbookTemplatesListResult(_serialization.Model): + """WorkbookTemplate list result. + + :ivar value: An array of workbook templates. + :vartype value: list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[WorkbookTemplate]"}, + } + + def __init__(self, *, value: Optional[list["_models.WorkbookTemplate"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of workbook templates. + :paramtype value: list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate] + """ + super().__init__(**kwargs) + self.value = value + + +class WorkbookTemplateUpdateParameters(_serialization.Model): + """The parameters that can be provided when updating workbook template. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar priority: Priority of the template. Determines which template to open when a workbook + gallery is opened in viewer mode. + :vartype priority: int + :ivar author: Information about the author of the workbook template. + :vartype author: str + :ivar template_data: Valid JSON object containing workbook template payload. + :vartype template_data: JSON + :ivar galleries: Workbook galleries supported by the template. + :vartype galleries: + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] + :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages + supported by the Azure portal. + :vartype localized: dict[str, + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateLocalizedGallery]] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "priority": {"key": "properties.priority", "type": "int"}, + "author": {"key": "properties.author", "type": "str"}, + "template_data": {"key": "properties.templateData", "type": "object"}, + "galleries": {"key": "properties.galleries", "type": "[WorkbookTemplateGallery]"}, + "localized": {"key": "properties.localized", "type": "{[WorkbookTemplateLocalizedGallery]}"}, + } + + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + priority: Optional[int] = None, + author: Optional[str] = None, + template_data: Optional[JSON] = None, + galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, + localized: Optional[dict[str, list["_models.WorkbookTemplateLocalizedGallery"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword priority: Priority of the template. Determines which template to open when a workbook + gallery is opened in viewer mode. + :paramtype priority: int + :keyword author: Information about the author of the workbook template. + :paramtype author: str + :keyword template_data: Valid JSON object containing workbook template payload. + :paramtype template_data: JSON + :keyword galleries: Workbook galleries supported by the template. + :paramtype galleries: + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] + :keyword localized: Key value pair of localized gallery. Each key is the locale code of + languages supported by the Azure portal. + :paramtype localized: dict[str, + list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateLocalizedGallery]] + """ + super().__init__(**kwargs) + self.tags = tags + self.priority = priority + self.author = author + self.template_data = template_data + self.galleries = galleries + self.localized = localized diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/__init__.py new file mode 100644 index 000000000000..aa730bc20e57 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._workbook_templates_operations import WorkbookTemplatesOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbookTemplatesOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_workbook_templates_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_workbook_templates_operations.py similarity index 89% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_workbook_templates_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_workbook_templates_operations.py index 01e7af11686c..88728d9e31f8 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_workbook_templates_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_workbook_templates_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -31,7 +32,7 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -209,7 +210,7 @@ class WorkbookTemplatesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2020_11_20.ApplicationInsightsManagementClient`'s :attr:`workbook_templates` attribute. """ @@ -232,13 +233,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite Required. :type resource_group_name: str :return: An iterator like instance of either WorkbookTemplate or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.WorkbookTemplate] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate] :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", "2020-11-20")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -262,7 +264,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -285,7 +298,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookTemplateError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookTemplateError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -302,7 +318,7 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m :param resource_name: The name of the Application Insights component resource. Required. :type resource_name: str :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -316,7 +332,7 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) _request = build_get_request( @@ -338,7 +354,10 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookTemplateError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookTemplateError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) @@ -374,7 +393,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -396,7 +415,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookTemplateError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookTemplateError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -421,12 +443,13 @@ def create_or_update( :type resource_name: str :param workbook_template_properties: Properties that need to be specified to create a new workbook. Required. - :type workbook_template_properties: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :type workbook_template_properties: + ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ @@ -454,7 +477,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ @@ -475,10 +498,10 @@ def create_or_update( :type resource_name: str :param workbook_template_properties: Properties that need to be specified to create a new workbook. Is either a WorkbookTemplate type or a IO[bytes] type. Required. - :type workbook_template_properties: ~azure.mgmt.applicationinsights.models.WorkbookTemplate or - IO[bytes] + :type workbook_template_properties: + ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate or IO[bytes] :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -492,7 +515,7 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) @@ -526,7 +549,10 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookTemplateError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookTemplateError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) @@ -556,12 +582,12 @@ def update( :param workbook_template_update_parameters: Properties that need to be specified to patch a workbook template. Default value is None. :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.models.WorkbookTemplateUpdateParameters + ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ @@ -589,7 +615,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ @@ -614,9 +640,10 @@ def update( workbook template. Is either a WorkbookTemplateUpdateParameters type or a IO[bytes] type. Default value is None. :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.models.WorkbookTemplateUpdateParameters or IO[bytes] + ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateUpdateParameters or + IO[bytes] :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -630,11 +657,12 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_template_update_parameters else None cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if workbook_template_update_parameters else None _json = None _content = None if isinstance(workbook_template_update_parameters, (IOBase, bytes)): @@ -667,7 +695,10 @@ def update( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookTemplateError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookTemplateError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_application_insights_management_client.py new file mode 100644 index 000000000000..fc49f70ba967 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_application_insights_management_client.py @@ -0,0 +1,128 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import MyWorkbooksOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar my_workbooks: MyWorkbooksOperations operations + :vartype my_workbooks: + azure.mgmt.applicationinsights.v2021_03_08.operations.MyWorkbooksOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-03-08". 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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.my_workbooks = MyWorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_configuration.py new file mode 100644 index 000000000000..64dc84eb047d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-03-08". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2021-03-08") + + 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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..fda965eba0a2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_application_insights_management_client.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import MyWorkbooksOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar my_workbooks: MyWorkbooksOperations operations + :vartype my_workbooks: + azure.mgmt.applicationinsights.v2021_03_08.aio.operations.MyWorkbooksOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-03-08". 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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.my_workbooks = MyWorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_configuration.py new file mode 100644 index 000000000000..0ed7231f6616 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-03-08". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2021-03-08") + + 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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/__init__.py new file mode 100644 index 000000000000..05ffdf9526ba --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._my_workbooks_operations import MyWorkbooksOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "MyWorkbooksOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_my_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_my_workbooks_operations.py new file mode 100644 index 000000000000..1a026fb87964 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_my_workbooks_operations.py @@ -0,0 +1,683 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._my_workbooks_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_update_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class MyWorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2021_03_08.aio.ApplicationInsightsManagementClient`'s + :attr:`my_workbooks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.MyWorkbook"]: + """Get all private workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either MyWorkbook or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + source_id=source_id, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MyWorkbooksListResult", 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.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.MyWorkbook"]: + """Get all private workbooks defined within a specified subscription and category. + + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either MyWorkbook or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MyWorkbooksListResult", 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.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.MyWorkbook: + """Get a single private workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Delete a private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.MyWorkbook, + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.MyWorkbook, IO[bytes]], + source_id: Optional[str] = None, + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook or + IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "MyWorkbook") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.MyWorkbook, + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.MyWorkbook, IO[bytes]], + source_id: Optional[str] = None, + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook or + IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "MyWorkbook") + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/__init__.py new file mode 100644 index 000000000000..7ff21bf3e6ae --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/__init__.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ErrorDefinition, + InnerErrorTrace, + MyWorkbook, + MyWorkbookError, + MyWorkbookManagedIdentity, + MyWorkbookResource, + MyWorkbookUserAssignedIdentities, + MyWorkbooksListResult, + SystemData, +) + +from ._application_insights_management_client_enums import ( # type: ignore + CategoryType, + CreatedByType, + Kind, + MyWorkbookManagedIdentityType, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ErrorDefinition", + "InnerErrorTrace", + "MyWorkbook", + "MyWorkbookError", + "MyWorkbookManagedIdentity", + "MyWorkbookResource", + "MyWorkbookUserAssignedIdentities", + "MyWorkbooksListResult", + "SystemData", + "CategoryType", + "CreatedByType", + "Kind", + "MyWorkbookManagedIdentityType", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_application_insights_management_client_enums.py new file mode 100644 index 000000000000..b5b139725464 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_application_insights_management_client_enums.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CategoryType.""" + + WORKBOOK = "workbook" + TSG = "TSG" + PERFORMANCE = "performance" + RETENTION = "retention" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of workbook. Choices are user and shared.""" + + USER = "user" + SHARED = "shared" + + +class MyWorkbookManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The identity type.""" + + USER_ASSIGNED = "UserAssigned" + NONE = "None" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_models_py3.py new file mode 100644 index 000000000000..093f47a17013 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_models_py3.py @@ -0,0 +1,469 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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, Optional, TYPE_CHECKING, Union + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models + + +class ErrorDefinition(_serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar innererror: Internal error details. + :vartype innererror: any + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "innererror": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "innererror": {"key": "innererror", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None + self.innererror: Optional[Any] = None + + +class InnerErrorTrace(_serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar trace: detailed error trace. + :vartype trace: list[str] + """ + + _validation = { + "trace": {"readonly": True}, + } + + _attribute_map = { + "trace": {"key": "trace", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.trace: Optional[list[str]] = None + + +class MyWorkbookResource(_serialization.Model): + """An azure resource object. + + :ivar identity: Identity used for BYOS. + :vartype identity: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentity + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: Resource etag. + :vartype etag: dict[str, str] + """ + + _attribute_map = { + "identity": {"key": "identity", "type": "MyWorkbookManagedIdentity"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "{str}"}, + } + + def __init__( + self, + *, + identity: Optional["_models.MyWorkbookManagedIdentity"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + etag: Optional[dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: Identity used for BYOS. + :paramtype identity: + ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentity + :keyword id: Azure resource Id. + :paramtype id: str + :keyword name: Azure resource name. + :paramtype name: str + :keyword type: Azure resource type. + :paramtype type: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword etag: Resource etag. + :paramtype etag: dict[str, str] + """ + super().__init__(**kwargs) + self.identity = identity + self.id = id + self.name = name + self.type = type + self.location = location + self.tags = tags + self.etag = etag + + +class MyWorkbook(MyWorkbookResource): + """An Application Insights private workbook definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar identity: Identity used for BYOS. + :vartype identity: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentity + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar etag: Resource etag. + :vartype etag: dict[str, str] + :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.Kind + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.applicationinsights.v2021_03_08.models.SystemData + :ivar display_name: The user-defined name of the private workbook. + :vartype display_name: str + :ivar serialized_data: Configuration of this particular private workbook. Configuration data is + a string containing valid JSON. + :vartype serialized_data: str + :ivar version: This instance's version of the data model. This can change as new features are + added that can be marked private workbook. + :vartype version: str + :ivar time_modified: Date and time in UTC of the last modification that was made to this + private workbook definition. + :vartype time_modified: str + :ivar category: Workbook category, as defined by the user at creation time. + :vartype category: str + :ivar tags_properties_tags: A list of 0 or more tags that are associated with this private + workbook definition. + :vartype tags_properties_tags: list[str] + :ivar user_id: Unique user id of the specific user that owns this private workbook. + :vartype user_id: str + :ivar source_id: Optional resourceId for a source resource. + :vartype source_id: str + :ivar storage_uri: BYOS Storage Account URI. + :vartype storage_uri: str + """ + + _validation = { + "system_data": {"readonly": True}, + "time_modified": {"readonly": True}, + "user_id": {"readonly": True}, + } + + _attribute_map = { + "identity": {"key": "identity", "type": "MyWorkbookManagedIdentity"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "etag": {"key": "etag", "type": "{str}"}, + "kind": {"key": "kind", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "serialized_data": {"key": "properties.serializedData", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "time_modified": {"key": "properties.timeModified", "type": "str"}, + "category": {"key": "properties.category", "type": "str"}, + "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, + "user_id": {"key": "properties.userId", "type": "str"}, + "source_id": {"key": "properties.sourceId", "type": "str"}, + "storage_uri": {"key": "properties.storageUri", "type": "str"}, + } + + def __init__( + self, + *, + identity: Optional["_models.MyWorkbookManagedIdentity"] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + etag: Optional[dict[str, str]] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + display_name: Optional[str] = None, + serialized_data: Optional[str] = None, + version: Optional[str] = None, + category: Optional[str] = None, + tags_properties_tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + storage_uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: Identity used for BYOS. + :paramtype identity: + ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentity + :keyword id: Azure resource Id. + :paramtype id: str + :keyword name: Azure resource name. + :paramtype name: str + :keyword type: Azure resource type. + :paramtype type: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword etag: Resource etag. + :paramtype etag: dict[str, str] + :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and + "shared". + :paramtype kind: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.Kind + :keyword display_name: The user-defined name of the private workbook. + :paramtype display_name: str + :keyword serialized_data: Configuration of this particular private workbook. Configuration data + is a string containing valid JSON. + :paramtype serialized_data: str + :keyword version: This instance's version of the data model. This can change as new features + are added that can be marked private workbook. + :paramtype version: str + :keyword category: Workbook category, as defined by the user at creation time. + :paramtype category: str + :keyword tags_properties_tags: A list of 0 or more tags that are associated with this private + workbook definition. + :paramtype tags_properties_tags: list[str] + :keyword source_id: Optional resourceId for a source resource. + :paramtype source_id: str + :keyword storage_uri: BYOS Storage Account URI. + :paramtype storage_uri: str + """ + super().__init__( + identity=identity, id=id, name=name, type=type, location=location, tags=tags, etag=etag, **kwargs + ) + self.kind = kind + self.system_data: Optional["_models.SystemData"] = None + self.display_name = display_name + self.serialized_data = serialized_data + self.version = version + self.time_modified: Optional[str] = None + self.category = category + self.tags_properties_tags = tags_properties_tags + self.user_id: Optional[str] = None + self.source_id = source_id + self.storage_uri = storage_uri + + +class MyWorkbookError(_serialization.Model): + """Error response. + + :ivar error: The error details. + :vartype error: ~azure.mgmt.applicationinsights.v2021_03_08.models.ErrorDefinition + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDefinition"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error details. + :paramtype error: ~azure.mgmt.applicationinsights.v2021_03_08.models.ErrorDefinition + """ + super().__init__(**kwargs) + self.error = error + + +class MyWorkbookManagedIdentity(_serialization.Model): + """Customer Managed Identity. + + :ivar user_assigned_identities: Customer Managed Identity. + :vartype user_assigned_identities: + ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookUserAssignedIdentities + :ivar type: The identity type. Known values are: "UserAssigned" and "None". + :vartype type: str or + ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentityType + """ + + _attribute_map = { + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "MyWorkbookUserAssignedIdentities"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + user_assigned_identities: Optional["_models.MyWorkbookUserAssignedIdentities"] = None, + type: Optional[Union[str, "_models.MyWorkbookManagedIdentityType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword user_assigned_identities: Customer Managed Identity. + :paramtype user_assigned_identities: + ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookUserAssignedIdentities + :keyword type: The identity type. Known values are: "UserAssigned" and "None". + :paramtype type: str or + ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentityType + """ + super().__init__(**kwargs) + self.user_assigned_identities = user_assigned_identities + self.type = type + + +class MyWorkbooksListResult(_serialization.Model): + """Workbook list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of private workbooks. + :vartype value: list[~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[MyWorkbook]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value: Optional[list["_models.MyWorkbook"]] = None + self.next_link = next_link + + +class MyWorkbookUserAssignedIdentities(_serialization.Model): + """Customer Managed Identity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or + ~azure.mgmt.applicationinsights.v2021_03_08.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.applicationinsights.v2021_03_08.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.applicationinsights.v2021_03_08.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.applicationinsights.v2021_03_08.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 diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/__init__.py new file mode 100644 index 000000000000..05ffdf9526ba --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._my_workbooks_operations import MyWorkbooksOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "MyWorkbooksOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_my_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_my_workbooks_operations.py new file mode 100644 index 000000000000..35841e2f3bf9 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_my_workbooks_operations.py @@ -0,0 +1,912 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +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_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks", + ) + 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["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + if source_id is not None: + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + _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_subscription_request( + subscription_id: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks") + 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["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request(resource_group_name: str, 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", "2021-03-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, 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", "2021-03-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + source_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if source_id is not None: + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + source_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if source_id is not None: + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +class MyWorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2021_03_08.ApplicationInsightsManagementClient`'s + :attr:`my_workbooks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.MyWorkbook"]: + """Get all private workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either MyWorkbook or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + source_id=source_id, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MyWorkbooksListResult", 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.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription( + self, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.MyWorkbook"]: + """Get all private workbooks defined within a specified subscription and category. + + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either MyWorkbook or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MyWorkbooksListResult", 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.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.MyWorkbook: + """Get a single private workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Delete a private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.MyWorkbook, + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.MyWorkbook, IO[bytes]], + source_id: Optional[str] = None, + **kwargs: Any + ) -> _models.MyWorkbook: + """Create a new private workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook or + IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "MyWorkbook") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.MyWorkbook, + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Required. + :type workbook_properties: IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.MyWorkbook, IO[bytes]], + source_id: Optional[str] = None, + **kwargs: Any + ) -> _models.MyWorkbook: + """Updates a private workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new private + workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook or + IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :return: MyWorkbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "MyWorkbook") + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.MyWorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_application_insights_management_client.py new file mode 100644 index 000000000000..aea35925c5d6 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_application_insights_management_client.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import WorkbooksOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar workbooks: WorkbooksOperations operations + :vartype workbooks: azure.mgmt.applicationinsights.v2021_08_01.operations.WorkbooksOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-08-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_configuration.py new file mode 100644 index 000000000000..acd975d365fc --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-08-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2021-08-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..30fb977e68a0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_application_insights_management_client.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import WorkbooksOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar workbooks: WorkbooksOperations operations + :vartype workbooks: + azure.mgmt.applicationinsights.v2021_08_01.aio.operations.WorkbooksOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-08-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_configuration.py new file mode 100644 index 000000000000..f3c38bf2bf3d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-08-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2021-08-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/__init__.py new file mode 100644 index 000000000000..244af54256b7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._workbooks_operations import WorkbooksOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbooksOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_workbooks_operations.py new file mode 100644 index 000000000000..2603125e7a39 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_workbooks_operations.py @@ -0,0 +1,849 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._workbooks_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_resource_group_request, + build_list_by_subscription_request, + build_revision_get_request, + build_revisions_list_request, + build_update_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class WorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2021_08_01.aio.ApplicationInsightsManagementClient`'s + :attr:`workbooks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription( + self, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified subscription and category. + + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either Workbook or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either Workbook or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + source_id=source_id, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, can_fetch_content: Optional[bool] = None, **kwargs: Any + ) -> _models.Workbook: + """Get a single workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Delete a workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.Workbook, + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.Workbook, IO[bytes]], + source_id: Optional[str] = None, + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. Is + either a Workbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook or + IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "Workbook") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + source_id: Optional[str] = None, + workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + source_id: Optional[str] = None, + workbook_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + source_id: Optional[str] = None, + workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookUpdateParameters or IO[bytes] + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_update_parameters else None + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if workbook_update_parameters else None + _json = None + _content = None + if isinstance(workbook_update_parameters, (IOBase, bytes)): + _content = workbook_update_parameters + else: + if workbook_update_parameters is not None: + _json = self._serialize.body(workbook_update_parameters, "WorkbookUpdateParameters") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def revisions_list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Workbook"]: + """Get the revisions for the workbook defined by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: An iterator like instance of either Workbook or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_revisions_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def revision_get( + self, resource_group_name: str, resource_name: str, revision_id: str, **kwargs: Any + ) -> _models.Workbook: + """Get a single workbook revision defined by its revisionId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param revision_id: The id of the workbook's revision. Required. + :type revision_id: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_revision_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + revision_id=revision_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/__init__.py new file mode 100644 index 000000000000..68da5baea7a6 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ManagedServiceIdentity, + Resource, + SystemData, + TrackedResource, + UserAssignedIdentity, + Workbook, + WorkbookError, + WorkbookErrorDefinition, + WorkbookInnerErrorTrace, + WorkbookResource, + WorkbookResourceIdentity, + WorkbookUpdateParameters, + WorkbooksListResult, +) + +from ._application_insights_management_client_enums import ( # type: ignore + CategoryType, + CreatedByType, + Kind, + ManagedServiceIdentityType, + SharedTypeKind, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ManagedServiceIdentity", + "Resource", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "Workbook", + "WorkbookError", + "WorkbookErrorDefinition", + "WorkbookInnerErrorTrace", + "WorkbookResource", + "WorkbookResourceIdentity", + "WorkbookUpdateParameters", + "WorkbooksListResult", + "CategoryType", + "CreatedByType", + "Kind", + "ManagedServiceIdentityType", + "SharedTypeKind", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_application_insights_management_client_enums.py new file mode 100644 index 000000000000..e774a1a1297a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_application_insights_management_client_enums.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CategoryType.""" + + WORKBOOK = "workbook" + TSG = "TSG" + PERFORMANCE = "performance" + RETENTION = "retention" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of workbook. Only valid value is shared.""" + + USER = "user" + SHARED = "shared" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + + +class SharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of workbook. Only valid value is shared.""" + + USER = "user" + SHARED = "shared" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_models_py3.py new file mode 100644 index 000000000000..380140c5d29a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_models_py3.py @@ -0,0 +1,706 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Optional, TYPE_CHECKING, Union + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models + + +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or + ~azure.mgmt.applicationinsights.v2021_08_01.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.applicationinsights.v2021_08_01.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :paramtype type: str or + ~azure.mgmt.applicationinsights.v2021_08_01.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.applicationinsights.v2021_08_01.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +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: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or + ~azure.mgmt.applicationinsights.v2021_08_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.applicationinsights.v2021_08_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.applicationinsights.v2021_08_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.applicationinsights.v2021_08_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 TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None + + +class WorkbookResource(TrackedResource): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Identity used for BYOS. + :vartype identity: ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookResourceIdentity + :ivar kind: The kind of workbook. Only valid value is shared. Known values are: "user" and + "shared". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.Kind + :ivar etag: Resource etag. + :vartype etag: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "WorkbookResourceIdentity"}, + "kind": {"key": "kind", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.WorkbookResourceIdentity"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + etag: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword identity: Identity used for BYOS. + :paramtype identity: + ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookResourceIdentity + :keyword kind: The kind of workbook. Only valid value is shared. Known values are: "user" and + "shared". + :paramtype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.Kind + :keyword etag: Resource etag. + :paramtype etag: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.kind = kind + self.etag = etag + + +class Workbook(WorkbookResource): + """An Application Insights workbook definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Identity used for BYOS. + :vartype identity: ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookResourceIdentity + :ivar kind: The kind of workbook. Only valid value is shared. Known values are: "user" and + "shared". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.Kind + :ivar etag: Resource etag. + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.applicationinsights.v2021_08_01.models.SystemData + :ivar display_name: The user-defined name (display name) of the workbook. + :vartype display_name: str + :ivar serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :vartype serialized_data: str + :ivar version: Workbook schema version format, like 'Notebook/1.0', which should match the + workbook in serializedData. + :vartype version: str + :ivar time_modified: Date and time in UTC of the last modification that was made to this + workbook definition. + :vartype time_modified: ~datetime.datetime + :ivar category: Workbook category, as defined by the user at creation time. + :vartype category: str + :ivar tags_properties_tags: Being deprecated, please use the other tags field. + :vartype tags_properties_tags: list[str] + :ivar user_id: Unique user id of the specific user that owns this workbook. + :vartype user_id: str + :ivar source_id: ResourceId for a source resource. + :vartype source_id: str + :ivar storage_uri: The resourceId to the storage account when bring your own storage is used. + :vartype storage_uri: str + :ivar description: The description of the workbook. + :vartype description: str + :ivar revision: The unique revision id for this workbook definition. + :vartype revision: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "time_modified": {"readonly": True}, + "user_id": {"readonly": True}, + "revision": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "WorkbookResourceIdentity"}, + "kind": {"key": "kind", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "serialized_data": {"key": "properties.serializedData", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "time_modified": {"key": "properties.timeModified", "type": "iso-8601"}, + "category": {"key": "properties.category", "type": "str"}, + "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, + "user_id": {"key": "properties.userId", "type": "str"}, + "source_id": {"key": "properties.sourceId", "type": "str"}, + "storage_uri": {"key": "properties.storageUri", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "revision": {"key": "properties.revision", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.WorkbookResourceIdentity"] = None, + kind: Optional[Union[str, "_models.Kind"]] = None, + etag: Optional[str] = None, + display_name: Optional[str] = None, + serialized_data: Optional[str] = None, + version: Optional[str] = None, + category: Optional[str] = None, + tags_properties_tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + storage_uri: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword identity: Identity used for BYOS. + :paramtype identity: + ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookResourceIdentity + :keyword kind: The kind of workbook. Only valid value is shared. Known values are: "user" and + "shared". + :paramtype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.Kind + :keyword etag: Resource etag. + :paramtype etag: str + :keyword display_name: The user-defined name (display name) of the workbook. + :paramtype display_name: str + :keyword serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :paramtype serialized_data: str + :keyword version: Workbook schema version format, like 'Notebook/1.0', which should match the + workbook in serializedData. + :paramtype version: str + :keyword category: Workbook category, as defined by the user at creation time. + :paramtype category: str + :keyword tags_properties_tags: Being deprecated, please use the other tags field. + :paramtype tags_properties_tags: list[str] + :keyword source_id: ResourceId for a source resource. + :paramtype source_id: str + :keyword storage_uri: The resourceId to the storage account when bring your own storage is + used. + :paramtype storage_uri: str + :keyword description: The description of the workbook. + :paramtype description: str + """ + super().__init__(tags=tags, location=location, identity=identity, kind=kind, etag=etag, **kwargs) + self.system_data: Optional["_models.SystemData"] = None + self.display_name = display_name + self.serialized_data = serialized_data + self.version = version + self.time_modified: Optional[datetime.datetime] = None + self.category = category + self.tags_properties_tags = tags_properties_tags + self.user_id: Optional[str] = None + self.source_id = source_id + self.storage_uri = storage_uri + self.description = description + self.revision: Optional[str] = None + + +class WorkbookError(_serialization.Model): + """Error response. + + :ivar error: The error details. + :vartype error: ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookErrorDefinition + """ + + _attribute_map = { + "error": {"key": "error", "type": "WorkbookErrorDefinition"}, + } + + def __init__(self, *, error: Optional["_models.WorkbookErrorDefinition"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error details. + :paramtype error: ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookErrorDefinition + """ + super().__init__(**kwargs) + self.error = error + + +class WorkbookErrorDefinition(_serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar innererror: Internal error details. + :vartype innererror: ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookInnerErrorTrace + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "innererror": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "innererror": {"key": "innererror", "type": "WorkbookInnerErrorTrace"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None + self.innererror: Optional["_models.WorkbookInnerErrorTrace"] = None + + +class WorkbookInnerErrorTrace(_serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar trace: detailed error trace. + :vartype trace: list[str] + """ + + _validation = { + "trace": {"readonly": True}, + } + + _attribute_map = { + "trace": {"key": "trace", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.trace: Optional[list[str]] = None + + +class WorkbookResourceIdentity(ManagedServiceIdentity): + """Identity used for BYOS. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or + ~azure.mgmt.applicationinsights.v2021_08_01.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.applicationinsights.v2021_08_01.models.UserAssignedIdentity] + """ + + +class WorkbooksListResult(_serialization.Model): + """Workbook list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of workbooks. + :vartype value: list[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Workbook]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value: Optional[list["_models.Workbook"]] = None + self.next_link = next_link + + +class WorkbookUpdateParameters(_serialization.Model): + """The parameters that can be provided when updating workbook properties properties. + + :ivar kind: The kind of workbook. Only valid value is shared. Known values are: "user" and + "shared". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.SharedTypeKind + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar display_name: The user-defined name (display name) of the workbook. + :vartype display_name: str + :ivar serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :vartype serialized_data: str + :ivar category: Workbook category, as defined by the user at creation time. + :vartype category: str + :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook + definition. + :vartype tags_properties_tags: list[str] + :ivar description: The description of the workbook. + :vartype description: str + :ivar revision: The unique revision id for this workbook definition. + :vartype revision: str + """ + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "serialized_data": {"key": "properties.serializedData", "type": "str"}, + "category": {"key": "properties.category", "type": "str"}, + "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, + "description": {"key": "properties.description", "type": "str"}, + "revision": {"key": "properties.revision", "type": "str"}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, + tags: Optional[dict[str, str]] = None, + display_name: Optional[str] = None, + serialized_data: Optional[str] = None, + category: Optional[str] = None, + tags_properties_tags: Optional[list[str]] = None, + description: Optional[str] = None, + revision: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The kind of workbook. Only valid value is shared. Known values are: "user" and + "shared". + :paramtype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.SharedTypeKind + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword display_name: The user-defined name (display name) of the workbook. + :paramtype display_name: str + :keyword serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :paramtype serialized_data: str + :keyword category: Workbook category, as defined by the user at creation time. + :paramtype category: str + :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook + definition. + :paramtype tags_properties_tags: list[str] + :keyword description: The description of the workbook. + :paramtype description: str + :keyword revision: The unique revision id for this workbook definition. + :paramtype revision: str + """ + super().__init__(**kwargs) + self.kind = kind + self.tags = tags + self.display_name = display_name + self.serialized_data = serialized_data + self.category = category + self.tags_properties_tags = tags_properties_tags + self.description = description + self.revision = revision diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/__init__.py new file mode 100644 index 000000000000..244af54256b7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._workbooks_operations import WorkbooksOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbooksOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_workbooks_operations.py new file mode 100644 index 000000000000..dc40b653fb8b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_workbooks_operations.py @@ -0,0 +1,1152 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request( + subscription_id: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/workbooks") + 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["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks", + ) + 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["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + if source_id is not None: + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, 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", "2021-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + source_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if source_id is not None: + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + source_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if source_id is not None: + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_revisions_list_request( + resource_group_name: str, 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", "2021-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_revision_get_request( + resource_group_name: str, resource_name: str, revision_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions/{revisionId}", + ) + 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 + ), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "revisionId": _SERIALIZER.url("revision_id", revision_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class WorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.v2021_08_01.ApplicationInsightsManagementClient`'s + :attr:`workbooks` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription( + self, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified subscription and category. + + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either Workbook or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + category: Union[str, _models.CategoryType], + tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :type category: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.CategoryType + :param tags: Tags presents on each workbook returned. Default value is None. + :type tags: list[str] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: An iterator like instance of either Workbook or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + source_id=source_id, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, can_fetch_content: Optional[bool] = None, **kwargs: Any + ) -> _models.Workbook: + """Get a single workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :type can_fetch_content: bool + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Delete a workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.Workbook, + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + source_id: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.Workbook, IO[bytes]], + source_id: Optional[str] = None, + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. Is + either a Workbook type or a IO[bytes] type. Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook or + IO[bytes] + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _json = self._serialize.body(workbook_properties, "Workbook") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + source_id: Optional[str] = None, + workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + source_id: Optional[str] = None, + workbook_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + source_id: Optional[str] = None, + workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :type source_id: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookUpdateParameters or IO[bytes] + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_update_parameters else None + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if workbook_update_parameters else None + _json = None + _content = None + if isinstance(workbook_update_parameters, (IOBase, bytes)): + _content = workbook_update_parameters + else: + if workbook_update_parameters is not None: + _json = self._serialize.body(workbook_update_parameters, "WorkbookUpdateParameters") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def revisions_list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> ItemPaged["_models.Workbook"]: + """Get the revisions for the workbook defined by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: An iterator like instance of either Workbook or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_revisions_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def revision_get( + self, resource_group_name: str, resource_name: str, revision_id: str, **kwargs: Any + ) -> _models.Workbook: + """Get a single workbook revision defined by its revisionId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param revision_id: The id of the workbook's revision. Required. + :type revision_id: str + :return: Workbook or the result of cls(response) + :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_revision_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + revision_id=revision_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Workbook", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_application_insights_management_client.py new file mode 100644 index 000000000000..8570ad8e8bdc --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_application_insights_management_client.py @@ -0,0 +1,120 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import LiveTokenOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar live_token: LiveTokenOperations operations + :vartype live_token: azure.mgmt.applicationinsights.v2021_10.operations.LiveTokenOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param base_url: Service URL. Default value is None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-10-14". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_configuration.py new file mode 100644 index 000000000000..b86ae0570284 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_configuration.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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-10-14". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, credential: "TokenCredential", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2021-10-14") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + self.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..a03d33837d17 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_application_insights_management_client.py @@ -0,0 +1,124 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import LiveTokenOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar live_token: LiveTokenOperations operations + :vartype live_token: azure.mgmt.applicationinsights.v2021_10.aio.operations.LiveTokenOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param base_url: Service URL. Default value is None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-10-14". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_configuration.py new file mode 100644 index 000000000000..a5e4c12cc189 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_configuration.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. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2021-10-14". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, credential: "AsyncTokenCredential", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2021-10-14") + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + + self.credential = credential + self.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/__init__.py new file mode 100644 index 000000000000..46b276948dcf --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._live_token_operations import LiveTokenOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "LiveTokenOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_live_token_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_live_token_operations.py similarity index 89% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_live_token_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_live_token_operations.py index ace6ed0f5ad7..d99d8f7dd6d3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_live_token_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_live_token_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar from azure.core import AsyncPipelineClient from azure.core.exceptions import ( @@ -29,7 +29,7 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] class LiveTokenOperations: @@ -38,7 +38,7 @@ class LiveTokenOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2021_10.aio.ApplicationInsightsManagementClient`'s :attr:`live_token` attribute. """ @@ -60,7 +60,7 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenRespon :param resource_uri: The identifier of the resource. Required. :type resource_uri: str :return: LiveTokenResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.LiveTokenResponse + :rtype: ~azure.mgmt.applicationinsights.v2021_10.models.LiveTokenResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -74,7 +74,7 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenRespon _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-10-14")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) _request = build_get_request( @@ -94,7 +94,10 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenRespon if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseLinkedStorage, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("LiveTokenResponse", pipeline_response.http_response) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/__init__.py new file mode 100644 index 000000000000..04eb8d951dbb --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/__init__.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ErrorResponseLinkedStorage, + ErrorResponseLinkedStorageError, + LiveTokenResponse, + OperationInfo, + OperationLive, + OperationsListResult, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ErrorResponseLinkedStorage", + "ErrorResponseLinkedStorageError", + "LiveTokenResponse", + "OperationInfo", + "OperationLive", + "OperationsListResult", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_models_py3.py new file mode 100644 index 000000000000..a81c0b863e03 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_models_py3.py @@ -0,0 +1,218 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from collections.abc import MutableMapping +from typing import Any, Optional, TYPE_CHECKING + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models +JSON = MutableMapping[str, Any] + + +class ErrorResponseLinkedStorage(_serialization.Model): + """ErrorResponseLinkedStorage. + + :ivar error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :vartype error: ~azure.mgmt.applicationinsights.v2021_10.models.ErrorResponseLinkedStorageError + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorResponseLinkedStorageError"}, + } + + def __init__(self, *, error: Optional["_models.ErrorResponseLinkedStorageError"] = None, **kwargs: Any) -> None: + """ + :keyword error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :paramtype error: + ~azure.mgmt.applicationinsights.v2021_10.models.ErrorResponseLinkedStorageError + """ + super().__init__(**kwargs) + self.error = error + + +class ErrorResponseLinkedStorageError(_serialization.Model): + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None + + +class LiveTokenResponse(_serialization.Model): + """The response to a live token query. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar live_token: JWT token for accessing live metrics stream data. + :vartype live_token: str + """ + + _validation = { + "live_token": {"readonly": True}, + } + + _attribute_map = { + "live_token": {"key": "liveToken", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.live_token: Optional[str] = None + + +class OperationInfo(_serialization.Model): + """Information about an operation. + + :ivar provider: Name of the provider. + :vartype provider: str + :ivar resource: Name of the resource type. + :vartype resource: str + :ivar operation: Name of the operation. + :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: Name of the provider. + :paramtype provider: str + :keyword resource: Name of the resource type. + :paramtype resource: str + :keyword operation: Name of the operation. + :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 OperationLive(_serialization.Model): + """Represents an operation returned by the GetOperations request. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display name of the operation. + :vartype display: ~azure.mgmt.applicationinsights.v2021_10.models.OperationInfo + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: JSON + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationInfo"}, + "origin": {"key": "origin", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["_models.OperationInfo"] = None, + origin: Optional[str] = None, + properties: Optional[JSON] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display name of the operation. + :paramtype display: ~azure.mgmt.applicationinsights.v2021_10.models.OperationInfo + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: JSON + """ + super().__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + self.properties = properties + + +class OperationsListResult(_serialization.Model): + """Result of the List Operations operation. + + :ivar value: A collection of operations. + :vartype value: list[~azure.mgmt.applicationinsights.v2021_10.models.OperationLive] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[OperationLive]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[list["_models.OperationLive"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: A collection of operations. + :paramtype value: list[~azure.mgmt.applicationinsights.v2021_10.models.OperationLive] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/__init__.py new file mode 100644 index 000000000000..46b276948dcf --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._live_token_operations import LiveTokenOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "LiveTokenOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_live_token_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_live_token_operations.py similarity index 91% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_live_token_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_live_token_operations.py index 961959fc3689..d584dc57efd1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_live_token_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_live_token_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Optional, TypeVar from azure.core import PipelineClient from azure.core.exceptions import ( @@ -28,7 +28,7 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -64,7 +64,7 @@ class LiveTokenOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2021_10.ApplicationInsightsManagementClient`'s :attr:`live_token` attribute. """ @@ -86,7 +86,7 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: :param resource_uri: The identifier of the resource. Required. :type resource_uri: str :return: LiveTokenResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.LiveTokenResponse + :rtype: ~azure.mgmt.applicationinsights.v2021_10.models.LiveTokenResponse :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -100,7 +100,7 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-10-14")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) _request = build_get_request( @@ -120,7 +120,10 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseLinkedStorage, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("LiveTokenResponse", pipeline_response.http_response) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_application_insights_management_client.py new file mode 100644 index 000000000000..825d054bf86a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_application_insights_management_client.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import WorkbooksOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar workbooks: WorkbooksOperations operations + :vartype workbooks: azure.mgmt.applicationinsights.v2022_04_01.operations.WorkbooksOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2022-04-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_configuration.py new file mode 100644 index 000000000000..01a4dfcba07a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2022-04-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..a85a8096fcc4 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_application_insights_management_client.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import WorkbooksOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar workbooks: WorkbooksOperations operations + :vartype workbooks: + azure.mgmt.applicationinsights.v2022_04_01.aio.operations.WorkbooksOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2022-04-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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_configuration.py new file mode 100644 index 000000000000..8e0fcc46bd21 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2022-04-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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/__init__.py new file mode 100644 index 000000000000..244af54256b7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._workbooks_operations import WorkbooksOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbooksOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_workbooks_operations.py similarity index 83% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_workbooks_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_workbooks_operations.py index 8849e5308660..c12b5c3b3927 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_workbooks_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_workbooks_operations.py @@ -7,7 +7,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -41,7 +42,7 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] class WorkbooksOperations: @@ -50,7 +51,7 @@ class WorkbooksOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2022_04_01.aio.ApplicationInsightsManagementClient`'s :attr:`workbooks` attribute. """ @@ -69,7 +70,7 @@ def __init__(self, *args, **kwargs) -> None: def list_by_subscription( self, category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, + tags: Optional[list[str]] = None, can_fetch_content: Optional[bool] = None, **kwargs: Any ) -> AsyncItemPaged["_models.Workbook"]: @@ -77,7 +78,7 @@ def list_by_subscription( :param category: Category of workbook to return. Known values are: "workbook", "TSG", "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.models.CategoryType + :type category: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.CategoryType :param tags: Tags presents on each workbook returned. Default value is None. :type tags: list[str] :param can_fetch_content: Flag indicating whether or not to return the full content for each @@ -86,13 +87,13 @@ def list_by_subscription( :type can_fetch_content: bool :return: An iterator like instance of either Workbook or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] :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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -118,7 +119,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -141,7 +153,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -153,7 +168,7 @@ def list_by_resource_group( self, resource_group_name: str, category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, + tags: Optional[list[str]] = None, source_id: Optional[str] = None, can_fetch_content: Optional[bool] = None, **kwargs: Any @@ -165,7 +180,7 @@ def list_by_resource_group( :type resource_group_name: str :param category: Category of workbook to return. Known values are: "workbook", "TSG", "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.models.CategoryType + :type category: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.CategoryType :param tags: Tags presents on each workbook returned. Default value is None. :type tags: list[str] :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is @@ -177,13 +192,13 @@ def list_by_resource_group( :type can_fetch_content: bool :return: An iterator like instance of either Workbook or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] :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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -211,7 +226,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -234,7 +260,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -250,14 +279,14 @@ async def get( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param can_fetch_content: Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. Default value is None. :type can_fetch_content: bool :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -271,7 +300,7 @@ 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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) _request = build_get_request( @@ -294,7 +323,10 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workbook", pipeline_response.http_response) @@ -311,7 +343,7 @@ async def delete(self, resource_group_name: str, resource_name: str, **kwargs: A :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :return: None or the result of cls(response) :rtype: None @@ -328,7 +360,7 @@ async def delete(self, resource_group_name: str, resource_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -350,7 +382,10 @@ async def delete(self, resource_group_name: str, resource_name: str, **kwargs: A if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -372,11 +407,11 @@ async def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param workbook_properties: Properties that need to be specified to create a new workbook. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.models.Workbook + :type workbook_properties: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is None. :type source_id: str @@ -384,7 +419,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ @@ -404,7 +439,7 @@ async def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param workbook_properties: Properties that need to be specified to create a new workbook. Required. @@ -416,7 +451,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ @@ -434,16 +469,17 @@ async def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param workbook_properties: Properties that need to be specified to create a new workbook. Is either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.models.Workbook or IO[bytes] + :type workbook_properties: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook or + IO[bytes] :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is None. :type source_id: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -457,7 +493,7 @@ async def create_or_update( _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) @@ -492,7 +528,10 @@ async def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workbook", pipeline_response.http_response) @@ -518,7 +557,7 @@ async def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is None. @@ -526,12 +565,12 @@ async def update( :param workbook_update_parameters: Properties that need to be specified to create a new workbook. Default value is None. :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.models.WorkbookUpdateParameters + ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ @@ -551,7 +590,7 @@ async def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is None. @@ -563,7 +602,7 @@ async def update( Default value is "application/json". :paramtype content_type: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ @@ -581,7 +620,7 @@ async def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is None. @@ -589,9 +628,9 @@ async def update( :param workbook_update_parameters: Properties that need to be specified to create a new workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.models.WorkbookUpdateParameters or IO[bytes] + ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateParameters or IO[bytes] :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -605,11 +644,12 @@ async def update( _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_update_parameters else None cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if workbook_update_parameters else None _json = None _content = None if isinstance(workbook_update_parameters, (IOBase, bytes)): @@ -643,7 +683,10 @@ async def update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workbook", pipeline_response.http_response) @@ -662,17 +705,17 @@ def revisions_list( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :return: An iterator like instance of either Workbook or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] :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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -697,7 +740,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -720,7 +774,10 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -736,12 +793,12 @@ async def revision_get( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param revision_id: The id of the workbook's revision. Required. :type revision_id: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -755,7 +812,7 @@ async def revision_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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) _request = build_revision_get_request( @@ -778,7 +835,10 @@ async def revision_get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workbook", pipeline_response.http_response) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/__init__.py new file mode 100644 index 000000000000..3ef7aa01aafc --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ManagedServiceIdentity, + Resource, + SystemData, + TrackedResource, + UserAssignedIdentity, + Workbook, + WorkbookError, + WorkbookErrorDefinition, + WorkbookInnerErrorTrace, + WorkbookResource, + WorkbookResourceIdentity, + WorkbookUpdateParameters, + WorkbooksListResult, +) + +from ._application_insights_management_client_enums import ( # type: ignore + CategoryType, + CreatedByType, + ManagedServiceIdentityType, + WorkbookSharedTypeKind, + WorkbookUpdateSharedTypeKind, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ManagedServiceIdentity", + "Resource", + "SystemData", + "TrackedResource", + "UserAssignedIdentity", + "Workbook", + "WorkbookError", + "WorkbookErrorDefinition", + "WorkbookInnerErrorTrace", + "WorkbookResource", + "WorkbookResourceIdentity", + "WorkbookUpdateParameters", + "WorkbooksListResult", + "CategoryType", + "CreatedByType", + "ManagedServiceIdentityType", + "WorkbookSharedTypeKind", + "WorkbookUpdateSharedTypeKind", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_application_insights_management_client_enums.py new file mode 100644 index 000000000000..b927dae90683 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_application_insights_management_client_enums.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. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CategoryType.""" + + WORKBOOK = "workbook" + TSG = "TSG" + PERFORMANCE = "performance" + RETENTION = "retention" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity that created the resource.""" + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + + +class WorkbookSharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of workbook. Only valid value is shared.""" + + SHARED = "shared" + + +class WorkbookUpdateSharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of workbook. Only valid value is shared.""" + + SHARED = "shared" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_models_py3.py new file mode 100644 index 000000000000..08cb129a99de --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_models_py3.py @@ -0,0 +1,704 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Optional, TYPE_CHECKING, Union + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models + + +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or + ~azure.mgmt.applicationinsights.v2022_04_01.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.applicationinsights.v2022_04_01.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :paramtype type: str or + ~azure.mgmt.applicationinsights.v2022_04_01.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.applicationinsights.v2022_04_01.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +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: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + + +class SystemData(_serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or + ~azure.mgmt.applicationinsights.v2022_04_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.applicationinsights.v2022_04_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.applicationinsights.v2022_04_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.applicationinsights.v2022_04_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 TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None + + +class WorkbookResource(TrackedResource): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Identity used for BYOS. + :vartype identity: ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookResourceIdentity + :ivar kind: The kind of workbook. Only valid value is shared. "shared" + :vartype kind: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookSharedTypeKind + :ivar etag: Resource etag. + :vartype etag: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "WorkbookResourceIdentity"}, + "kind": {"key": "kind", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.WorkbookResourceIdentity"] = None, + kind: Optional[Union[str, "_models.WorkbookSharedTypeKind"]] = None, + etag: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword identity: Identity used for BYOS. + :paramtype identity: + ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookResourceIdentity + :keyword kind: The kind of workbook. Only valid value is shared. "shared" + :paramtype kind: str or + ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookSharedTypeKind + :keyword etag: Resource etag. + :paramtype etag: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.kind = kind + self.etag = etag + + +class Workbook(WorkbookResource): + """A workbook definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar identity: Identity used for BYOS. + :vartype identity: ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookResourceIdentity + :ivar kind: The kind of workbook. Only valid value is shared. "shared" + :vartype kind: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookSharedTypeKind + :ivar etag: Resource etag. + :vartype etag: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.applicationinsights.v2022_04_01.models.SystemData + :ivar display_name: The user-defined name (display name) of the workbook. + :vartype display_name: str + :ivar serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :vartype serialized_data: str + :ivar version: Workbook schema version format, like 'Notebook/1.0', which should match the + workbook in serializedData. + :vartype version: str + :ivar time_modified: Date and time in UTC of the last modification that was made to this + workbook definition. + :vartype time_modified: ~datetime.datetime + :ivar category: Workbook category, as defined by the user at creation time. + :vartype category: str + :ivar tags_properties_tags: Being deprecated, please use the other tags field. + :vartype tags_properties_tags: list[str] + :ivar user_id: Unique user id of the specific user that owns this workbook. + :vartype user_id: str + :ivar source_id: ResourceId for a source resource. + :vartype source_id: str + :ivar storage_uri: The resourceId to the storage account when bring your own storage is used. + :vartype storage_uri: str + :ivar description: The description of the workbook. + :vartype description: str + :ivar revision: The unique revision id for this workbook definition. + :vartype revision: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "system_data": {"readonly": True}, + "time_modified": {"readonly": True}, + "user_id": {"readonly": True}, + "revision": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "identity": {"key": "identity", "type": "WorkbookResourceIdentity"}, + "kind": {"key": "kind", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "serialized_data": {"key": "properties.serializedData", "type": "str"}, + "version": {"key": "properties.version", "type": "str"}, + "time_modified": {"key": "properties.timeModified", "type": "iso-8601"}, + "category": {"key": "properties.category", "type": "str"}, + "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, + "user_id": {"key": "properties.userId", "type": "str"}, + "source_id": {"key": "properties.sourceId", "type": "str"}, + "storage_uri": {"key": "properties.storageUri", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, + "revision": {"key": "properties.revision", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.WorkbookResourceIdentity"] = None, + kind: Optional[Union[str, "_models.WorkbookSharedTypeKind"]] = None, + etag: Optional[str] = None, + display_name: Optional[str] = None, + serialized_data: Optional[str] = None, + version: Optional[str] = None, + category: Optional[str] = None, + tags_properties_tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + storage_uri: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword identity: Identity used for BYOS. + :paramtype identity: + ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookResourceIdentity + :keyword kind: The kind of workbook. Only valid value is shared. "shared" + :paramtype kind: str or + ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookSharedTypeKind + :keyword etag: Resource etag. + :paramtype etag: str + :keyword display_name: The user-defined name (display name) of the workbook. + :paramtype display_name: str + :keyword serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :paramtype serialized_data: str + :keyword version: Workbook schema version format, like 'Notebook/1.0', which should match the + workbook in serializedData. + :paramtype version: str + :keyword category: Workbook category, as defined by the user at creation time. + :paramtype category: str + :keyword tags_properties_tags: Being deprecated, please use the other tags field. + :paramtype tags_properties_tags: list[str] + :keyword source_id: ResourceId for a source resource. + :paramtype source_id: str + :keyword storage_uri: The resourceId to the storage account when bring your own storage is + used. + :paramtype storage_uri: str + :keyword description: The description of the workbook. + :paramtype description: str + """ + super().__init__(tags=tags, location=location, identity=identity, kind=kind, etag=etag, **kwargs) + self.system_data: Optional["_models.SystemData"] = None + self.display_name = display_name + self.serialized_data = serialized_data + self.version = version + self.time_modified: Optional[datetime.datetime] = None + self.category = category + self.tags_properties_tags = tags_properties_tags + self.user_id: Optional[str] = None + self.source_id = source_id + self.storage_uri = storage_uri + self.description = description + self.revision: Optional[str] = None + + +class WorkbookError(_serialization.Model): + """Error response. + + :ivar error: The error details. + :vartype error: ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookErrorDefinition + """ + + _attribute_map = { + "error": {"key": "error", "type": "WorkbookErrorDefinition"}, + } + + def __init__(self, *, error: Optional["_models.WorkbookErrorDefinition"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error details. + :paramtype error: ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookErrorDefinition + """ + super().__init__(**kwargs) + self.error = error + + +class WorkbookErrorDefinition(_serialization.Model): + """Error definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar innererror: Internal error details. + :vartype innererror: ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookInnerErrorTrace + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "innererror": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "innererror": {"key": "innererror", "type": "WorkbookInnerErrorTrace"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None + self.innererror: Optional["_models.WorkbookInnerErrorTrace"] = None + + +class WorkbookInnerErrorTrace(_serialization.Model): + """Error details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar trace: detailed error trace. + :vartype trace: list[str] + """ + + _validation = { + "trace": {"readonly": True}, + } + + _attribute_map = { + "trace": {"key": "trace", "type": "[str]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.trace: Optional[list[str]] = None + + +class WorkbookResourceIdentity(ManagedServiceIdentity): + """Identity used for BYOS. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or + ~azure.mgmt.applicationinsights.v2022_04_01.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.applicationinsights.v2022_04_01.models.UserAssignedIdentity] + """ + + +class WorkbooksListResult(_serialization.Model): + """Workbook list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of workbooks. + :vartype value: list[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Workbook]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value: Optional[list["_models.Workbook"]] = None + self.next_link = next_link + + +class WorkbookUpdateParameters(_serialization.Model): + """The parameters that can be provided when updating workbook properties properties. + + :ivar kind: The kind of workbook. Only valid value is shared. "shared" + :vartype kind: str or + ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateSharedTypeKind + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar display_name: The user-defined name (display name) of the workbook. + :vartype display_name: str + :ivar serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :vartype serialized_data: str + :ivar category: Workbook category, as defined by the user at creation time. + :vartype category: str + :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook + definition. + :vartype tags_properties_tags: list[str] + :ivar description: The description of the workbook. + :vartype description: str + :ivar revision: The unique revision id for this workbook definition. + :vartype revision: str + """ + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "serialized_data": {"key": "properties.serializedData", "type": "str"}, + "category": {"key": "properties.category", "type": "str"}, + "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, + "description": {"key": "properties.description", "type": "str"}, + "revision": {"key": "properties.revision", "type": "str"}, + } + + def __init__( + self, + *, + kind: Optional[Union[str, "_models.WorkbookUpdateSharedTypeKind"]] = None, + tags: Optional[dict[str, str]] = None, + display_name: Optional[str] = None, + serialized_data: Optional[str] = None, + category: Optional[str] = None, + tags_properties_tags: Optional[list[str]] = None, + description: Optional[str] = None, + revision: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The kind of workbook. Only valid value is shared. "shared" + :paramtype kind: str or + ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateSharedTypeKind + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword display_name: The user-defined name (display name) of the workbook. + :paramtype display_name: str + :keyword serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :paramtype serialized_data: str + :keyword category: Workbook category, as defined by the user at creation time. + :paramtype category: str + :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook + definition. + :paramtype tags_properties_tags: list[str] + :keyword description: The description of the workbook. + :paramtype description: str + :keyword revision: The unique revision id for this workbook definition. + :paramtype revision: str + """ + super().__init__(**kwargs) + self.kind = kind + self.tags = tags + self.display_name = display_name + self.serialized_data = serialized_data + self.category = category + self.tags_properties_tags = tags_properties_tags + self.description = description + self.revision = revision diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/__init__.py new file mode 100644 index 000000000000..244af54256b7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._workbooks_operations import WorkbooksOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WorkbooksOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_workbooks_operations.py similarity index 86% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_workbooks_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_workbooks_operations.py index 5f7ac656c701..0198a232e7fa 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_workbooks_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_workbooks_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -31,7 +32,7 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -41,14 +42,14 @@ def build_list_by_subscription_request( subscription_id: str, *, category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, + tags: Optional[list[str]] = None, can_fetch_content: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +79,7 @@ def build_list_by_resource_group_request( subscription_id: str, *, category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, + tags: Optional[list[str]] = None, source_id: Optional[str] = None, can_fetch_content: Optional[bool] = None, **kwargs: Any @@ -86,7 +87,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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +131,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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +166,7 @@ def build_delete_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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,7 +204,7 @@ def build_create_or_update_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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -246,7 +247,7 @@ def build_update_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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -284,7 +285,7 @@ def build_revisions_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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -317,7 +318,7 @@ def build_revision_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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -351,7 +352,7 @@ class WorkbooksOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2022_04_01.ApplicationInsightsManagementClient`'s :attr:`workbooks` attribute. """ @@ -370,7 +371,7 @@ def __init__(self, *args, **kwargs) -> None: def list_by_subscription( self, category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, + tags: Optional[list[str]] = None, can_fetch_content: Optional[bool] = None, **kwargs: Any ) -> ItemPaged["_models.Workbook"]: @@ -378,7 +379,7 @@ def list_by_subscription( :param category: Category of workbook to return. Known values are: "workbook", "TSG", "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.models.CategoryType + :type category: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.CategoryType :param tags: Tags presents on each workbook returned. Default value is None. :type tags: list[str] :param can_fetch_content: Flag indicating whether or not to return the full content for each @@ -386,13 +387,14 @@ def list_by_subscription( None. :type can_fetch_content: bool :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] :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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -418,7 +420,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -441,7 +454,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -453,7 +469,7 @@ def list_by_resource_group( self, resource_group_name: str, category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, + tags: Optional[list[str]] = None, source_id: Optional[str] = None, can_fetch_content: Optional[bool] = None, **kwargs: Any @@ -465,7 +481,7 @@ def list_by_resource_group( :type resource_group_name: str :param category: Category of workbook to return. Known values are: "workbook", "TSG", "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.models.CategoryType + :type category: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.CategoryType :param tags: Tags presents on each workbook returned. Default value is None. :type tags: list[str] :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is @@ -476,13 +492,14 @@ def list_by_resource_group( None. :type can_fetch_content: bool :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] :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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -510,7 +527,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -533,7 +561,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -549,14 +580,14 @@ def get( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param can_fetch_content: Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks. Default value is None. :type can_fetch_content: bool :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -570,7 +601,7 @@ 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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) _request = build_get_request( @@ -593,7 +624,10 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workbook", pipeline_response.http_response) @@ -612,7 +646,7 @@ def delete( # pylint: disable=inconsistent-return-statements :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :return: None or the result of cls(response) :rtype: None @@ -629,7 +663,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -651,7 +685,10 @@ def delete( # pylint: disable=inconsistent-return-statements if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -673,11 +710,11 @@ def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param workbook_properties: Properties that need to be specified to create a new workbook. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.models.Workbook + :type workbook_properties: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is None. :type source_id: str @@ -685,7 +722,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ @@ -705,7 +742,7 @@ def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param workbook_properties: Properties that need to be specified to create a new workbook. Required. @@ -717,7 +754,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ @@ -735,16 +772,17 @@ def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param workbook_properties: Properties that need to be specified to create a new workbook. Is either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.models.Workbook or IO[bytes] + :type workbook_properties: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook or + IO[bytes] :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is None. :type source_id: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -758,7 +796,7 @@ def create_or_update( _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) @@ -793,7 +831,10 @@ def create_or_update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workbook", pipeline_response.http_response) @@ -819,7 +860,7 @@ def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is None. @@ -827,12 +868,12 @@ def update( :param workbook_update_parameters: Properties that need to be specified to create a new workbook. Default value is None. :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.models.WorkbookUpdateParameters + ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateParameters :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ @@ -852,7 +893,7 @@ def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is None. @@ -864,7 +905,7 @@ def update( Default value is "application/json". :paramtype content_type: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ @@ -882,7 +923,7 @@ def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is None. @@ -890,9 +931,9 @@ def update( :param workbook_update_parameters: Properties that need to be specified to create a new workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.models.WorkbookUpdateParameters or IO[bytes] + ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateParameters or IO[bytes] :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -906,11 +947,12 @@ def update( _headers = case_insensitive_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-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_update_parameters else None cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/json" if workbook_update_parameters else None _json = None _content = None if isinstance(workbook_update_parameters, (IOBase, bytes)): @@ -944,7 +986,10 @@ def update( if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workbook", pipeline_response.http_response) @@ -963,16 +1008,17 @@ def revisions_list( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] :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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -997,7 +1043,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1020,7 +1077,10 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response @@ -1036,12 +1096,12 @@ def revision_get( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :param resource_name: The name of the resource. Required. :type resource_name: str :param revision_id: The id of the workbook's revision. Required. :type revision_id: str :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -1055,7 +1115,7 @@ def revision_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", "2023-06-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) _request = build_revision_get_request( @@ -1078,7 +1138,10 @@ def revision_get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.WorkbookError, pipeline_response) + error = self._deserialize.failsafe_deserialize( + _models.WorkbookError, + pipeline_response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("Workbook", pipeline_response.http_response) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/__init__.py new file mode 100644 index 000000000000..da2ffef86618 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_application_insights_management_client.py new file mode 100644 index 000000000000..9a6611593429 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_application_insights_management_client.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from ._configuration import ApplicationInsightsManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import WebTestsOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar web_tests: WebTestsOperations operations + :vartype web_tests: azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2022-06-15". 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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_configuration.py new file mode 100644 index 000000000000..90176abc4620 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials import TokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2022-06-15". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2022-06-15") + + 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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/serialization.py new file mode 100644 index 000000000000..6da830e0cf4a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/serialization.py @@ -0,0 +1,2041 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +# pyright: reportUnnecessaryTypeIgnoreComment=false + +from base64 import b64decode, b64encode +import calendar +import datetime +import decimal +import email +from enum import Enum +import json +import logging +import re +import sys +import codecs +from typing import ( + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + MutableMapping, +) + +try: + from urllib import quote # type: ignore +except ImportError: + from urllib.parse import quote +import xml.etree.ElementTree as ET + +import isodate # type: ignore +from typing_extensions import Self + +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull + +_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") + +JSON = MutableMapping[str, Any] + + +class RawDeserializer: + + # Accept "text" because we're open minded people... + JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") + + # Name used in context + CONTEXT_NAME = "deserialized_data" + + @classmethod + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: + """Decode data according to content-type. + + Accept a stream of data as well, but will be load at once in memory for now. + + If no content-type, will return the string version (not bytes, not stream) + + :param data: Input, could be bytes or stream (will be decoded with UTF8) or text + :type data: str or bytes or IO + :param str content_type: The content type. + :return: The deserialized data. + :rtype: object + """ + if hasattr(data, "read"): + # Assume a stream + data = cast(IO, data).read() + + if isinstance(data, bytes): + data_as_str = data.decode(encoding="utf-8-sig") + else: + # Explain to mypy the correct type. + data_as_str = cast(str, data) + + # Remove Byte Order Mark if present in string + data_as_str = data_as_str.lstrip(_BOM) + + if content_type is None: + return data + + if cls.JSON_REGEXP.match(content_type): + try: + return json.loads(data_as_str) + except ValueError as err: + raise DeserializationError("JSON is invalid: {}".format(err), err) from err + elif "xml" in (content_type or []): + try: + + try: + if isinstance(data, unicode): # type: ignore + # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string + data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore + except NameError: + pass + + return ET.fromstring(data_as_str) # nosec + except ET.ParseError as err: + # It might be because the server has an issue, and returned JSON with + # content-type XML.... + # So let's try a JSON load, and if it's still broken + # let's flow the initial exception + def _json_attemp(data): + try: + return True, json.loads(data) + except ValueError: + return False, None # Don't care about this one + + success, json_result = _json_attemp(data) + if success: + return json_result + # If i'm here, it's not JSON, it's not XML, let's scream + # and raise the last context in this block (the XML exception) + # The function hack is because Py2.7 messes up with exception + # context otherwise. + _LOGGER.critical("Wasn't XML not JSON, failing") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str + raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) + + @classmethod + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: + """Deserialize from HTTP response. + + Use bytes and headers to NOT use any requests/aiohttp or whatever + specific implementation. + Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object + """ + # Try to use content-type from headers if available + content_type = None + if "content-type" in headers: + content_type = headers["content-type"].split(";")[0].strip().lower() + # Ouch, this server did not declare what it sent... + # Let's guess it's JSON... + # Also, since Autorest was considering that an empty body was a valid JSON, + # need that test as well.... + else: + content_type = "application/json" + + if body_bytes: + return cls.deserialize_from_text(body_bytes, content_type) + return None + + +_LOGGER = logging.getLogger(__name__) + +try: + _long_type = long # type: ignore +except NameError: + _long_type = int + +TZ_UTC = datetime.timezone.utc + +_FLATTEN = re.compile(r"(? None: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items + if k not in self._attribute_map: + _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) + elif k in self._validation and self._validation[k].get("readonly", False): + _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) + else: + setattr(self, k, kwargs[k]) + + def __eq__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ + if isinstance(other, self.__class__): + return self.__dict__ == other.__dict__ + return False + + def __ne__(self, other: Any) -> bool: + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ + return not self.__eq__(other) + + def __str__(self) -> str: + return str(self.__dict__) + + @classmethod + def enable_additional_properties_sending(cls) -> None: + cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} + + @classmethod + def is_xml_model(cls) -> bool: + try: + cls._xml_map # type: ignore + except AttributeError: + return False + return True + + @classmethod + def _create_xml_node(cls): + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ + try: + xml_map = cls._xml_map # type: ignore + except AttributeError: + xml_map = {} + + return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) + + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: + """Return the JSON that would be sent to server from this model. + + This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) + + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. + + Advanced usage might optionally use a callback as parameter: + + .. code::python + + def my_key_transformer(key, attr_desc, value): + return key + + Key is the attribute name used in Python. Attr_desc + is a dict of metadata. Currently contains 'type' with the + msrest type and 'key' with the RestAPI encoded key. + Value is the current value in this object. + + The string returned will be used to serialize the key. + If the return type is a list, this is considered hierarchical + result dict. + + See the three examples in this file: + + - attribute_transformer + - full_restapi_key_transformer + - last_restapi_key_transformer + + If you want XML serialization, you can pass the kwargs is_xml=True. + + :param bool keep_readonly: If you want to serialize the readonly attributes + :param function key_transformer: A key transformer function. + :returns: A dict JSON compatible object + :rtype: dict + """ + serializer = Serializer(self._infer_class_models()) + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) + + @classmethod + def _infer_class_models(cls): + try: + str_models = cls.__module__.rsplit(".", 1)[0] + models = sys.modules[str_models] + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + if cls.__name__ not in client_models: + raise ValueError("Not Autorest generated code") + except Exception: # pylint: disable=broad-exception-caught + # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. + client_models = {cls.__name__: cls} + return client_models + + @classmethod + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: + """Parse a str using the RestAPI syntax and return a model. + + :param str data: A str using RestAPI structure. JSON by default. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def from_dict( + cls, + data: Any, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> Self: + """Parse a dict using given key extractor return a model. + + By default consider key + extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor + and last_rest_key_case_insensitive_extractor) + + :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. + :param str content_type: JSON by default, set application/xml if XML. + :returns: An instance of this model + :raises DeserializationError: if something went wrong + :rtype: Self + """ + deserializer = Deserializer(cls._infer_class_models()) + deserializer.key_extractors = ( # type: ignore + [ # type: ignore + attribute_key_case_insensitive_extractor, + rest_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + if key_extractors is None + else key_extractors + ) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore + + @classmethod + def _flatten_subtype(cls, key, objects): + if "_subtype_map" not in cls.__dict__: + return {} + result = dict(cls._subtype_map[key]) + for valuetype in cls._subtype_map[key].values(): + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access + return result + + @classmethod + def _classify(cls, response, objects): + """Check the class _subtype_map for any child classes. + We want to ignore any inherited _subtype_maps. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class + """ + for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): + subtype_value = None + + if not isinstance(response, ET.Element): + rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) + else: + subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) + if subtype_value: + # Try to match base class. Can be class name only + # (bug to fix in Autorest to support x-ms-discriminator-name) + if cls.__name__ == subtype_value: + return cls + flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) + try: + return objects[flatten_mapping_type[subtype_value]] # type: ignore + except KeyError: + _LOGGER.warning( + "Subtype value %s has no mapping, use base class %s.", + subtype_value, + cls.__name__, + ) + break + else: + _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) + break + return cls + + @classmethod + def _get_rest_key_parts(cls, attr_key): + """Get the RestAPI key of this attr, split it and decode part + :param str attr_key: Attribute key must be in attribute_map. + :returns: A list of RestAPI part + :rtype: list + """ + rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) + return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] + + +def _decode_attribute_map_key(key): + """This decode a key in an _attribute_map to the actual key we want to look at + inside the received data. + + :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str + """ + return key.replace("\\.", ".") + + +class Serializer: # pylint: disable=too-many-public-methods + """Request object model serializer.""" + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} + days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} + months = { + 1: "Jan", + 2: "Feb", + 3: "Mar", + 4: "Apr", + 5: "May", + 6: "Jun", + 7: "Jul", + 8: "Aug", + 9: "Sep", + 10: "Oct", + 11: "Nov", + 12: "Dec", + } + validation = { + "min_length": lambda x, y: len(x) < y, + "max_length": lambda x, y: len(x) > y, + "minimum": lambda x, y: x < y, + "maximum": lambda x, y: x > y, + "minimum_ex": lambda x, y: x <= y, + "maximum_ex": lambda x, y: x >= y, + "min_items": lambda x, y: len(x) < y, + "max_items": lambda x, y: len(x) > y, + "pattern": lambda x, y: not re.match(y, x, re.UNICODE), + "unique": lambda x, y: len(x) != len(set(x)), + "multiple": lambda x, y: x % y != 0, + } + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.serialize_type = { + "iso-8601": Serializer.serialize_iso, + "rfc-1123": Serializer.serialize_rfc, + "unix-time": Serializer.serialize_unix, + "duration": Serializer.serialize_duration, + "date": Serializer.serialize_date, + "time": Serializer.serialize_time, + "decimal": Serializer.serialize_decimal, + "long": Serializer.serialize_long, + "bytearray": Serializer.serialize_bytearray, + "base64": Serializer.serialize_base64, + "object": self.serialize_object, + "[]": self.serialize_iter, + "{}": self.serialize_dict, + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_transformer = full_restapi_key_transformer + self.client_side_validation = True + + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): + """Serialize data into a string according to type. + + :param object target_obj: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, dict + :raises SerializationError: if serialization fails. + :returns: The serialized data. + """ + key_transformer = kwargs.get("key_transformer", self.key_transformer) + keep_readonly = kwargs.get("keep_readonly", False) + if target_obj is None: + return None + + attr_name = None + class_name = target_obj.__class__.__name__ + + if data_type: + return self.serialize_data(target_obj, data_type, **kwargs) + + if not hasattr(target_obj, "_attribute_map"): + data_type = type(target_obj).__name__ + if data_type in self.basic_types.values(): + return self.serialize_data(target_obj, data_type, **kwargs) + + # Force "is_xml" kwargs if we detect a XML model + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) + + serialized = {} + if is_xml_model_serialization: + serialized = target_obj._create_xml_node() # pylint: disable=protected-access + try: + attributes = target_obj._attribute_map # pylint: disable=protected-access + for attr, attr_desc in attributes.items(): + attr_name = attr + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): + continue + + if attr_name == "additional_properties" and attr_desc["key"] == "": + if target_obj.additional_properties is not None: + serialized |= target_obj.additional_properties + continue + try: + + orig_attr = getattr(target_obj, attr) + if is_xml_model_serialization: + pass # Don't provide "transformer" for XML for now. Keep "orig_attr" + else: # JSON + keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) + keys = keys if isinstance(keys, list) else [keys] + + kwargs["serialization_ctxt"] = attr_desc + new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) + + if is_xml_model_serialization: + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + xml_prefix = xml_desc.get("prefix", None) + xml_ns = xml_desc.get("ns", None) + if xml_desc.get("attr", False): + if xml_ns: + ET.register_namespace(xml_prefix, xml_ns) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + serialized.set(xml_name, new_attr) # type: ignore + continue + if xml_desc.get("text", False): + serialized.text = new_attr # type: ignore + continue + if isinstance(new_attr, list): + serialized.extend(new_attr) # type: ignore + elif isinstance(new_attr, ET.Element): + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. + if "name" not in getattr(orig_attr, "_xml_map", {}): + splitted_tag = new_attr.tag.split("}") + if len(splitted_tag) == 2: # Namespace + new_attr.tag = "}".join([splitted_tag[0], xml_name]) + else: + new_attr.tag = xml_name + serialized.append(new_attr) # type: ignore + else: # That's a basic type + # Integrate namespace if necessary + local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) + local_node.text = str(new_attr) + serialized.append(local_node) # type: ignore + else: # JSON + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} + + _new_attr = new_attr + _serialized = serialized + for k in keys: # type: ignore + if k not in _serialized: + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore + _serialized = _serialized[k] + except ValueError as err: + if isinstance(err, SerializationError): + raise + + except (AttributeError, KeyError, TypeError) as err: + msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) + raise SerializationError(msg) from err + return serialized + + def body(self, data, data_type, **kwargs): + """Serialize data intended for a request body. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: dict + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body + """ + + # Just in case this is a dict + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) + try: + is_xml_model_serialization = kwargs["is_xml"] + except KeyError: + if internal_data_type and issubclass(internal_data_type, Model): + is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) + else: + is_xml_model_serialization = False + if internal_data_type and not isinstance(internal_data_type, Enum): + try: + deserializer = Deserializer(self.dependencies) + # Since it's on serialization, it's almost sure that format is not JSON REST + # We're not able to deal with additional properties for now. + deserializer.additional_properties_detection = False + if is_xml_model_serialization: + deserializer.key_extractors = [ # type: ignore + attribute_key_case_insensitive_extractor, + ] + else: + deserializer.key_extractors = [ + rest_key_case_insensitive_extractor, + attribute_key_case_insensitive_extractor, + last_rest_key_case_insensitive_extractor, + ] + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access + except DeserializationError as err: + raise SerializationError("Unable to build a model: " + str(err)) from err + + return self._serialize(data, data_type, **kwargs) + + def url(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL path. + + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + """ + try: + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + + if kwargs.get("skip_quote") is True: + output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output + + def query(self, name, data, data_type, **kwargs): + """Serialize data intended for a URL query. + + :param str name: The name of the query parameter. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str, list + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter + """ + try: + # Treat the list aside, since we don't want to encode the div separator + if data_type.startswith("["): + internal_data_type = data_type[1:-1] + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) + + # Not a list, regular serialization + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + if kwargs.get("skip_quote") is True: + output = str(output) + else: + output = quote(str(output), safe="") + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def header(self, name, data, data_type, **kwargs): + """Serialize data intended for a request header. + + :param str name: The name of the header. + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :rtype: str + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header + """ + try: + if data_type in ["[str]"]: + data = ["" if d is None else d for d in data] + + output = self.serialize_data(data, data_type, **kwargs) + if data_type == "bool": + output = json.dumps(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) + + def serialize_data(self, data, data_type, **kwargs): + """Serialize generic data according to supplied data type. + + :param object data: The data to be serialized. + :param str data_type: The type to be serialized from. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list + """ + if data is None: + raise ValueError("No value for given attribute") + + try: + if data is CoreNull: + return None + if data_type in self.basic_types.values(): + return self.serialize_basic(data, data_type, **kwargs) + + if data_type in self.serialize_type: + return self.serialize_type[data_type](data, **kwargs) + + # If dependencies is empty, try with current data class + # It has to be a subclass of Enum anyway + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) + if issubclass(enum_type, Enum): + return Serializer.serialize_enum(data, enum_obj=enum_type) + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.serialize_type: + return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) + + except (ValueError, TypeError) as err: + msg = "Unable to serialize value: {!r} as type: {!r}." + raise SerializationError(msg.format(data, data_type)) from err + return self._serialize(data, **kwargs) + + @classmethod + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements + custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) + if custom_serializer: + return custom_serializer + if kwargs.get("is_xml", False): + return cls._xml_basic_types_serializers.get(data_type) + + @classmethod + def serialize_basic(cls, data, data_type, **kwargs): + """Serialize basic builting data type. + Serializes objects to str, int, float or bool. + + Possible kwargs: + - basic_types_serializers dict[str, callable] : If set, use the callable as serializer + - is_xml bool : If set, use xml_basic_types_serializers + + :param obj data: Object to be serialized. + :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. + """ + custom_serializer = cls._get_custom_serializers(data_type, **kwargs) + if custom_serializer: + return custom_serializer(data) + if data_type == "str": + return cls.serialize_unicode(data) + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @classmethod + def serialize_unicode(cls, data): + """Special handling for serializing unicode strings in Py2. + Encode to UTF-8 if unicode, otherwise handle as a str. + + :param str data: Object to be serialized. + :rtype: str + :return: serialized object + """ + try: # If I received an enum, return its value + return data.value + except AttributeError: + pass + + try: + if isinstance(data, unicode): # type: ignore + # Don't change it, JSON and XML ElementTree are totally able + # to serialize correctly u'' strings + return data + except NameError: + return str(data) + return str(data) + + def serialize_iter(self, data, iter_type, div=None, **kwargs): + """Serialize iterable. + + Supported kwargs: + - serialization_ctxt dict : The current entry of _attribute_map, or same format. + serialization_ctxt['type'] should be same as data_type. + - is_xml bool : If set, serialize as XML + + :param list data: Object to be serialized. + :param str iter_type: Type of object in the iterable. + :param str div: If set, this str will be used to combine the elements + in the iterable into a combined string. Default is 'None'. + Defaults to False. + :rtype: list, str + :return: serialized iterable + """ + if isinstance(data, str): + raise SerializationError("Refuse str type as a valid iter type.") + + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + is_xml = kwargs.get("is_xml", False) + + serialized = [] + for d in data: + try: + serialized.append(self.serialize_data(d, iter_type, **kwargs)) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized.append(None) + + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + + if div: + serialized = ["" if s is None else str(s) for s in serialized] + serialized = div.join(serialized) + + if "xml" in serialization_ctxt or is_xml: + # XML serialization is more complicated + xml_desc = serialization_ctxt.get("xml", {}) + xml_name = xml_desc.get("name") + if not xml_name: + xml_name = serialization_ctxt["key"] + + # Create a wrap node if necessary (use the fact that Element and list have "append") + is_wrapped = xml_desc.get("wrapped", False) + node_name = xml_desc.get("itemsName", xml_name) + if is_wrapped: + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + else: + final_result = [] + # All list elements to "local_node" + for el in serialized: + if isinstance(el, ET.Element): + el_node = el + else: + el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + if el is not None: # Otherwise it writes "None" :-p + el_node.text = str(el) + final_result.append(el_node) + return final_result + return serialized + + def serialize_dict(self, attr, dict_type, **kwargs): + """Serialize a dictionary of objects. + + :param dict attr: Object to be serialized. + :param str dict_type: Type of object in the dictionary. + :rtype: dict + :return: serialized dictionary + """ + serialization_ctxt = kwargs.get("serialization_ctxt", {}) + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) + except ValueError as err: + if isinstance(err, SerializationError): + raise + serialized[self.serialize_unicode(key)] = None + + if "xml" in serialization_ctxt: + # XML serialization is more complicated + xml_desc = serialization_ctxt["xml"] + xml_name = xml_desc["name"] + + final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) + for key, value in serialized.items(): + ET.SubElement(final_result, key).text = value + return final_result + + return serialized + + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Serialize a generic object. + This will be handled as a dictionary. If object passed in is not + a basic type (str, int, float, dict, list) it will simply be + cast to str. + + :param dict attr: Object to be serialized. + :rtype: dict or str + :return: serialized object + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + return attr + obj_type = type(attr) + if obj_type in self.basic_types: + return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) + if obj_type is _long_type: + return self.serialize_long(attr) + if obj_type is str: + return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) + + # If it's a model or I know this dependency, serialize as a Model + if obj_type in self.dependencies.values() or isinstance(attr, Model): + return self._serialize(attr) + + if obj_type == dict: + serialized = {} + for key, value in attr.items(): + try: + serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) + except ValueError: + serialized[self.serialize_unicode(key)] = None + return serialized + + if obj_type == list: + serialized = [] + for obj in attr: + try: + serialized.append(self.serialize_object(obj, **kwargs)) + except ValueError: + pass + return serialized + return str(attr) + + @staticmethod + def serialize_enum(attr, enum_obj=None): + try: + result = attr.value + except AttributeError: + result = attr + try: + enum_obj(result) # type: ignore + return result + except ValueError as exc: + for enum_value in enum_obj: # type: ignore + if enum_value.value.lower() == str(attr).lower(): + return enum_value.value + error = "{!r} is not valid value for enum {!r}" + raise SerializationError(error.format(attr, enum_obj)) from exc + + @staticmethod + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument + """Serialize bytearray into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + return b64encode(attr).decode() + + @staticmethod + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument + """Serialize str into base-64 string. + + :param str attr: Object to be serialized. + :rtype: str + :return: serialized base64 + """ + encoded = b64encode(attr).decode("ascii") + return encoded.strip("=").replace("+", "-").replace("/", "_") + + @staticmethod + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Decimal object to float. + + :param decimal attr: Object to be serialized. + :rtype: float + :return: serialized decimal + """ + return float(attr) + + @staticmethod + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument + """Serialize long (Py2) or int (Py3). + + :param int attr: Object to be serialized. + :rtype: int/long + :return: serialized long + """ + return _long_type(attr) + + @staticmethod + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Date object into ISO-8601 formatted string. + + :param Date attr: Object to be serialized. + :rtype: str + :return: serialized date + """ + if isinstance(attr, str): + attr = isodate.parse_date(attr) + t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) + return t + + @staticmethod + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Time object into ISO-8601 formatted string. + + :param datetime.time attr: Object to be serialized. + :rtype: str + :return: serialized time + """ + if isinstance(attr, str): + attr = isodate.parse_time(attr) + t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) + if attr.microsecond: + t += ".{:02}".format(attr.microsecond) + return t + + @staticmethod + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into ISO-8601 formatted string. + + :param TimeDelta attr: Object to be serialized. + :rtype: str + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + return isodate.duration_isoformat(attr) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into RFC-1123 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises TypeError: if format invalid. + :return: serialized rfc + """ + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc + + return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( + Serializer.days[utc.tm_wday], + utc.tm_mday, + Serializer.months[utc.tm_mon], + utc.tm_year, + utc.tm_hour, + utc.tm_min, + utc.tm_sec, + ) + + @staticmethod + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into ISO-8601 formatted string. + + :param Datetime attr: Object to be serialized. + :rtype: str + :raises SerializationError: if format invalid. + :return: serialized iso + """ + if isinstance(attr, str): + attr = isodate.parse_datetime(attr) + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + utc = attr.utctimetuple() + if utc.tm_year > 9999 or utc.tm_year < 1: + raise OverflowError("Hit max or min date") + + microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") + if microseconds: + microseconds = "." + microseconds + date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( + utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec + ) + return date + microseconds + "Z" + except (ValueError, OverflowError) as err: + msg = "Unable to serialize datetime object." + raise SerializationError(msg) from err + except AttributeError as err: + msg = "ISO-8601 object must be valid Datetime object." + raise TypeError(msg) from err + + @staticmethod + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param Datetime attr: Object to be serialized. + :rtype: int + :raises SerializationError: if format invalid + :return: serialied unix + """ + if isinstance(attr, int): + return attr + try: + if not attr.tzinfo: + _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") + return int(calendar.timegm(attr.utctimetuple())) + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc + + +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + key = attr_desc["key"] + working_data = data + + while "." in key: + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(list[str], _FLATTEN.split(key)) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = working_data.get(working_key, data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + return working_data.get(key) + + +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): + key = attr_desc["key"] + working_data = data + + while "." in key: + dict_keys = _FLATTEN.split(key) + if len(dict_keys) == 1: + key = _decode_attribute_map_key(dict_keys[0]) + break + working_key = _decode_attribute_map_key(dict_keys[0]) + working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) + if working_data is None: + # If at any point while following flatten JSON path see None, it means + # that all properties under are None as well + return None + key = ".".join(dict_keys[1:]) + + if working_data: + return attribute_key_case_insensitive_extractor(key, None, working_data) + + +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_extractor(dict_keys[-1], None, data) + + +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ + key = attr_desc["key"] + dict_keys = _FLATTEN.split(key) + return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) + + +def attribute_key_extractor(attr, _, data): + return data.get(attr) + + +def attribute_key_case_insensitive_extractor(attr, _, data): + found_key = None + lower_attr = attr.lower() + for key in data: + if lower_attr == key.lower(): + found_key = key + break + + return data.get(found_key) + + +def _extract_name_from_internal_type(internal_type): + """Given an internal type XML description, extract correct XML name with namespace. + + :param dict internal_type: An model type + :rtype: tuple + :returns: A tuple XML name + namespace dict + """ + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + xml_name = internal_type_xml_map.get("name", internal_type.__name__) + xml_ns = internal_type_xml_map.get("ns", None) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + return xml_name + + +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements + if isinstance(data, dict): + return None + + # Test if this model is XML ready first + if not isinstance(data, ET.Element): + return None + + xml_desc = attr_desc.get("xml", {}) + xml_name = xml_desc.get("name", attr_desc["key"]) + + # Look for a children + is_iter_type = attr_desc["type"].startswith("[") + is_wrapped = xml_desc.get("wrapped", False) + internal_type = attr_desc.get("internalType", None) + internal_type_xml_map = getattr(internal_type, "_xml_map", {}) + + # Integrate namespace if necessary + xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) + if xml_ns: + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + + # If it's an attribute, that's simple + if xml_desc.get("attr", False): + return data.get(xml_name) + + # If it's x-ms-text, that's simple too + if xml_desc.get("text", False): + return data.text + + # Scenario where I take the local name: + # - Wrapped node + # - Internal type is an enum (considered basic types) + # - Internal type has no XML/Name node + if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): + children = data.findall(xml_name) + # If internal type has a local name and it's not a list, I use that name + elif not is_iter_type and internal_type and "name" in internal_type_xml_map: + xml_name = _extract_name_from_internal_type(internal_type) + children = data.findall(xml_name) + # That's an array + else: + if internal_type: # Complex type, ignore itemsName and use the complex type name + items_name = _extract_name_from_internal_type(internal_type) + else: + items_name = xml_desc.get("itemsName", xml_name) + children = data.findall(items_name) + + if len(children) == 0: + if is_iter_type: + if is_wrapped: + return None # is_wrapped no node, we want None + return [] # not wrapped, assume empty list + return None # Assume it's not there, maybe an optional node. + + # If is_iter_type and not wrapped, return all found children + if is_iter_type: + if not is_wrapped: + return children + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name + ) + ) + return list(children[0]) # Might be empty list and that's ok. + + # Here it's not a itertype, we should have found one element only or empty + if len(children) > 1: + raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) + return children[0] + + +class Deserializer: + """Response object model deserializer. + + :param dict classes: Class type dictionary for deserializing complex types. + :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. + """ + + basic_types = {str: "str", int: "int", bool: "bool", float: "float"} + + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: + self.deserialize_type = { + "iso-8601": Deserializer.deserialize_iso, + "rfc-1123": Deserializer.deserialize_rfc, + "unix-time": Deserializer.deserialize_unix, + "duration": Deserializer.deserialize_duration, + "date": Deserializer.deserialize_date, + "time": Deserializer.deserialize_time, + "decimal": Deserializer.deserialize_decimal, + "long": Deserializer.deserialize_long, + "bytearray": Deserializer.deserialize_bytearray, + "base64": Deserializer.deserialize_base64, + "object": self.deserialize_object, + "[]": self.deserialize_iter, + "{}": self.deserialize_dict, + } + self.deserialize_expected_types = { + "duration": (isodate.Duration, datetime.timedelta), + "iso-8601": (datetime.datetime), + } + self.dependencies: dict[str, type] = dict(classes) if classes else {} + self.key_extractors = [rest_key_extractor, xml_key_extractor] + # Additional properties only works if the "rest_key_extractor" is used to + # extract the keys. Making it to work whatever the key extractor is too much + # complicated, with no real scenario for now. + # So adding a flag to disable additional properties detection. This flag should be + # used if your expect the deserialization to NOT come from a JSON REST syntax. + # Otherwise, result are unexpected + self.additional_properties_detection = True + + def __call__(self, target_obj, response_data, content_type=None): + """Call the deserializer to process a REST response. + + :param str target_obj: Target data type to deserialize to. + :param requests.Response response_data: REST response object. + :param str content_type: Swagger "produces" if available. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + data = self._unpack_content(response_data, content_type) + return self._deserialize(target_obj, data) + + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements + """Call the deserializer on a model. + + Data needs to be already deserialized as JSON or XML ElementTree + + :param str target_obj: Target data type to deserialize to. + :param object data: Object to deserialize. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + # This is already a model, go recursive just in case + if hasattr(data, "_attribute_map"): + constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] + try: + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access + if attr in constants: + continue + value = getattr(data, attr) + if value is None: + continue + local_type = mapconfig["type"] + internal_data_type = local_type.strip("[]{}") + if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): + continue + setattr(data, attr, self._deserialize(local_type, value)) + return data + except AttributeError: + return + + response, class_name = self._classify_target(target_obj, data) + + if isinstance(response, str): + return self.deserialize_data(data, response) + if isinstance(response, type) and issubclass(response, Enum): + return self.deserialize_enum(data, response) + + if data is None or data is CoreNull: + return data + try: + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access + d_attrs = {} + for attr, attr_desc in attributes.items(): + # Check empty string. If it's not empty, someone has a real "additionalProperties"... + if attr == "additional_properties" and attr_desc["key"] == "": + continue + raw_value = None + # Enhance attr_desc with some dynamic data + attr_desc = attr_desc.copy() # Do a copy, do not change the real one + internal_data_type = attr_desc["type"].strip("[]{}") + if internal_data_type in self.dependencies: + attr_desc["internalType"] = self.dependencies[internal_data_type] + + for key_extractor in self.key_extractors: + found_value = key_extractor(attr, attr_desc, data) + if found_value is not None: + if raw_value is not None and raw_value != found_value: + msg = ( + "Ignoring extracted value '%s' from %s for key '%s'" + " (duplicate extraction, follow extractors order)" + ) + _LOGGER.warning(msg, found_value, key_extractor, attr) + continue + raw_value = found_value + + value = self.deserialize_data(raw_value, attr_desc["type"]) + d_attrs[attr] = value + except (AttributeError, TypeError, KeyError) as err: + msg = "Unable to deserialize to object: " + class_name # type: ignore + raise DeserializationError(msg) from err + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) + + def _build_additional_properties(self, attribute_map, data): + if not self.additional_properties_detection: + return None + if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": + # Check empty string. If it's not empty, someone has a real "additionalProperties" + return None + if isinstance(data, ET.Element): + data = {el.tag: el.text for el in data} + + known_keys = { + _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) + for desc in attribute_map.values() + if desc["key"] != "" + } + present_keys = set(data.keys()) + missing_keys = present_keys - known_keys + return {key: data[key] for key in missing_keys} + + def _classify_target(self, target, data): + """Check to see whether the deserialization target object can + be classified into a subclass. + Once classification has been determined, initialize object. + + :param str target: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple + """ + if target is None: + return None, None + + if isinstance(target, str): + try: + target = self.dependencies[target] + except KeyError: + return target, target + + try: + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access + except AttributeError: + pass # Target is not a Model, no classify + return target, target.__class__.__name__ # type: ignore + + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deserialize. + :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object + """ + try: + return self(target_obj, data, content_type=content_type) + except: # pylint: disable=bare-except + _LOGGER.debug( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + @staticmethod + def _unpack_content(raw_data, content_type=None): + """Extract the correct structure for deserialization. + + If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. + if we can't, raise. Your Pipeline should have a RawDeserializer. + + If not a pipeline response and raw_data is bytes or string, use content-type + to decode it. If no content-type, try JSON. + + If raw_data is something else, bypass all logic and return it directly. + + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. + :raises JSONDecodeError: If JSON is requested and parsing is impossible. + :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. + """ + # Assume this is enough to detect a Pipeline Response without importing it + context = getattr(raw_data, "context", {}) + if context: + if RawDeserializer.CONTEXT_NAME in context: + return context[RawDeserializer.CONTEXT_NAME] + raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") + + # Assume this is enough to recognize universal_http.ClientResponse without importing it + if hasattr(raw_data, "body"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) + + # Assume this enough to recognize requests.Response without importing it. + if hasattr(raw_data, "_content_consumed"): + return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) + + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore + return raw_data + + def _instantiate_model(self, response, attrs, additional_properties=None): + """Instantiate a response model passing in deserialized args. + + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. + """ + if callable(response): + subtype = getattr(response, "_subtype_map", {}) + try: + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] + kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} + response_obj = response(**kwargs) + for attr in readonly: + setattr(response_obj, attr, attrs.get(attr)) + if additional_properties: + response_obj.additional_properties = additional_properties # type: ignore + return response_obj + except TypeError as err: + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore + raise DeserializationError(msg + str(err)) from err + else: + try: + for attr, value in attrs.items(): + setattr(response, attr, value) + return response + except Exception as exp: + msg = "Unable to populate response model. " + msg += "Type: {}, Error: {}".format(type(response), exp) + raise DeserializationError(msg) from exp + + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements + """Process data for deserialization according to data type. + + :param str data: The response string to be deserialized. + :param str data_type: The type to deserialize to. + :raises DeserializationError: if deserialization fails. + :return: Deserialized object. + :rtype: object + """ + if data is None: + return data + + try: + if not data_type: + return data + if data_type in self.basic_types.values(): + return self.deserialize_basic(data, data_type) + if data_type in self.deserialize_type: + if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): + return data + + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] + if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: + return None + data_val = self.deserialize_type[data_type](data) + return data_val + + iter_type = data_type[0] + data_type[-1] + if iter_type in self.deserialize_type: + return self.deserialize_type[iter_type](data, data_type[1:-1]) + + obj_type = self.dependencies[data_type] + if issubclass(obj_type, Enum): + if isinstance(data, ET.Element): + data = data.text + return self.deserialize_enum(data, obj_type) + + except (ValueError, TypeError, AttributeError) as err: + msg = "Unable to deserialize response data." + msg += " Data: {}, {}".format(data, data_type) + raise DeserializationError(msg) from err + return self._deserialize(obj_type, data) + + def deserialize_iter(self, attr, iter_type): + """Deserialize an iterable. + + :param list attr: Iterable to be deserialized. + :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. + :rtype: list + """ + if attr is None: + return None + if isinstance(attr, ET.Element): # If I receive an element here, get the children + attr = list(attr) + if not isinstance(attr, (list, set)): + raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) + return [self.deserialize_data(a, iter_type) for a in attr] + + def deserialize_dict(self, attr, dict_type): + """Deserialize a dictionary. + + :param dict/list attr: Dictionary to be deserialized. Also accepts + a list of key, value pairs. + :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. + :rtype: dict + """ + if isinstance(attr, list): + return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} + + if isinstance(attr, ET.Element): + # Transform value into {"Key": "value"} + attr = {el.tag: el.text for el in attr} + return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} + + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements + """Deserialize a generic object. + This will be handled as a dictionary. + + :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. + :rtype: dict + :raises TypeError: if non-builtin datatype encountered. + """ + if attr is None: + return None + if isinstance(attr, ET.Element): + # Do no recurse on XML, just return the tree as-is + return attr + if isinstance(attr, str): + return self.deserialize_basic(attr, "str") + obj_type = type(attr) + if obj_type in self.basic_types: + return self.deserialize_basic(attr, self.basic_types[obj_type]) + if obj_type is _long_type: + return self.deserialize_long(attr) + + if obj_type == dict: + deserialized = {} + for key, value in attr.items(): + try: + deserialized[key] = self.deserialize_object(value, **kwargs) + except ValueError: + deserialized[key] = None + return deserialized + + if obj_type == list: + deserialized = [] + for obj in attr: + try: + deserialized.append(self.deserialize_object(obj, **kwargs)) + except ValueError: + pass + return deserialized + + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) + + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements + """Deserialize basic builtin data type from string. + Will attempt to convert to str, int, float and bool. + This function will also accept '1', '0', 'true' and 'false' as + valid bool values. + + :param str attr: response string to be deserialized. + :param str data_type: deserialization data type. + :return: Deserialized basic type. + :rtype: str, int, float or bool + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. + """ + # If we're here, data is supposed to be a basic type. + # If it's still an XML node, take the text + if isinstance(attr, ET.Element): + attr = attr.text + if not attr: + if data_type == "str": + # None or '', node is empty string. + return "" + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None + + if data_type == "bool": + if attr in [True, False, 1, 0]: + return bool(attr) + if isinstance(attr, str): + if attr.lower() in ["true", "1"]: + return True + if attr.lower() in ["false", "0"]: + return False + raise TypeError("Invalid boolean value: {}".format(attr)) + + if data_type == "str": + return self.deserialize_unicode(attr) + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) + + @staticmethod + def deserialize_unicode(data): + """Preserve unicode objects in Python 2, otherwise return data + as a string. + + :param str data: response string to be deserialized. + :return: Deserialized string. + :rtype: str or unicode + """ + # We might be here because we have an enum modeled as string, + # and we try to deserialize a partial dict with enum inside + if isinstance(data, Enum): + return data + + # Consider this is real string + try: + if isinstance(data, unicode): # type: ignore + return data + except NameError: + return str(data) + return str(data) + + @staticmethod + def deserialize_enum(data, enum_obj): + """Deserialize string into enum object. + + If the string is not a valid enum value it will be returned as-is + and a warning will be logged. + + :param str data: Response string to be deserialized. If this value is + None or invalid it will be returned as-is. + :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. + :rtype: Enum + """ + if isinstance(data, enum_obj) or data is None: + return data + if isinstance(data, Enum): + data = data.value + if isinstance(data, int): + # Workaround. We might consider remove it in the future. + try: + return list(enum_obj.__members__.values())[data] + except IndexError as exc: + error = "{!r} is not a valid index for enum {!r}" + raise DeserializationError(error.format(data, enum_obj)) from exc + try: + return enum_obj(str(data)) + except ValueError: + for enum_value in enum_obj: + if enum_value.value.lower() == str(data).lower(): + return enum_value + # We don't fail anymore for unknown value, we deserialize as a string + _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) + return Deserializer.deserialize_unicode(data) + + @staticmethod + def deserialize_bytearray(attr): + """Deserialize string into bytearray. + + :param str attr: response string to be deserialized. + :return: Deserialized bytearray + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return bytearray(b64decode(attr)) # type: ignore + + @staticmethod + def deserialize_base64(attr): + """Deserialize base64 encoded string into string. + + :param str attr: response string to be deserialized. + :return: Deserialized base64 string + :rtype: bytearray + :raises TypeError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return b64decode(encoded) + + @staticmethod + def deserialize_decimal(attr): + """Deserialize string into Decimal object. + + :param str attr: response string to be deserialized. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + return decimal.Decimal(str(attr)) # type: ignore + except decimal.DecimalException as err: + msg = "Invalid decimal {}".format(attr) + raise DeserializationError(msg) from err + + @staticmethod + def deserialize_long(attr): + """Deserialize string into long (Py2) or int (Py3). + + :param str attr: response string to be deserialized. + :return: Deserialized int + :rtype: long or int + :raises ValueError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + return _long_type(attr) # type: ignore + + @staticmethod + def deserialize_duration(attr): + """Deserialize ISO-8601 formatted string into TimeDelta object. + + :param str attr: response string to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = isodate.parse_duration(attr) + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_date(attr): + """Deserialize ISO-8601 formatted string into Date object. + + :param str attr: response string to be deserialized. + :return: Deserialized date + :rtype: Date + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) + + @staticmethod + def deserialize_time(attr): + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :return: Deserialized time + :rtype: datetime.time + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore + raise DeserializationError("Date must have only digits and -. Received: %s" % attr) + return isodate.parse_time(attr) + + @staticmethod + def deserialize_rfc(attr): + """Deserialize RFC-1123 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + parsed_date = email.utils.parsedate_tz(attr) # type: ignore + date_obj = datetime.datetime( + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + ) + if not date_obj.tzinfo: + date_obj = date_obj.astimezone(tz=TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to rfc datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_iso(attr): + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime + :rtype: Datetime + :raises DeserializationError: if string format invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + attr = attr.upper() # type: ignore + match = Deserializer.valid_date.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + except (ValueError, OverflowError, AttributeError) as err: + msg = "Cannot deserialize datetime object." + raise DeserializationError(msg) from err + return date_obj + + @staticmethod + def deserialize_unix(attr): + """Serialize Datetime object into IntTime format. + This is represented as seconds. + + :param int attr: Object to be serialized. + :return: Deserialized datetime + :rtype: Datetime + :raises DeserializationError: if format invalid + """ + if isinstance(attr, ET.Element): + attr = int(attr.text) # type: ignore + try: + attr = int(attr) + date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) + except ValueError as err: + msg = "Cannot deserialize to unix datetime object." + raise DeserializationError(msg) from err + return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_version.py new file mode 100644 index 000000000000..8231e0bce214 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/__init__.py new file mode 100644 index 000000000000..52caca38e9e7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_application_insights_management_client.py new file mode 100644 index 000000000000..bf5c7eac9184 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_application_insights_management_client.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from .._utils.serialization import Deserializer, Serializer +from ._configuration import ApplicationInsightsManagementClientConfiguration +from .operations import WebTestsOperations + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClient: + """Composite Swagger for Application Insights Management Client. + + :ivar web_tests: WebTestsOperations operations + :vartype web_tests: + azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations + :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 None. + :type base_url: str + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2022-06-15". 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: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationInsightsManagementClientConfiguration( + credential=credential, + subscription_id=subscription_id, + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, 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.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_configuration.py new file mode 100644 index 000000000000..3f3bbeb6f55d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_configuration.py @@ -0,0 +1,75 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING + +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core import AzureClouds + from azure.core.credentials_async import AsyncTokenCredential + + +class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ApplicationInsightsManagementClient. + + 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 + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: Api Version. Default value is "2022-06-15". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2022-06-15") + + 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.cloud_setting = cloud_setting + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + self._configure(**kwargs) + + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/__init__.py new file mode 100644 index 000000000000..87f6c44f1147 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._web_tests_operations import WebTestsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WebTestsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_web_tests_operations.py similarity index 87% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_web_tests_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_web_tests_operations.py index 629f1c458f7b..1b5c7f0dc575 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_web_tests_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_web_tests_operations.py @@ -7,7 +7,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,7 +41,8 @@ from .._configuration import ApplicationInsightsManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class WebTestsOperations: @@ -49,7 +51,7 @@ class WebTestsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2022_06_15.aio.ApplicationInsightsManagementClient`'s :attr:`web_tests` attribute. """ @@ -72,13 +74,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy Required. :type resource_group_name: str :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] :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", "2022-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -102,7 +105,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -141,7 +155,7 @@ async def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) :param web_test_name: The name of the Application Insights WebTest resource. Required. :type web_test_name: str :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -155,7 +169,7 @@ async def get(self, resource_group_name: str, web_test_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", "2022-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) _request = build_get_request( @@ -205,12 +219,12 @@ async def create_or_update( :type web_test_name: str :param web_test_definition: Properties that need to be specified to create or update an Application Insights web test definition. Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.models.WebTest + :type web_test_definition: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ @@ -238,7 +252,7 @@ async def create_or_update( Default value is "application/json". :paramtype content_type: str :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ @@ -260,9 +274,10 @@ async def create_or_update( :param web_test_definition: Properties that need to be specified to create or update an Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.models.WebTest or IO[bytes] + :type web_test_definition: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest or + IO[bytes] :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -276,7 +291,7 @@ async def create_or_update( _headers = case_insensitive_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-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) @@ -338,12 +353,12 @@ async def update_tags( :type web_test_name: str :param web_test_tags: Updated tag information to associate with the web test resource. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.models.TagsResource + :type web_test_tags: ~azure.mgmt.applicationinsights.v2022_06_15.models.TagsResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ @@ -371,7 +386,7 @@ async def update_tags( Default value is "application/json". :paramtype content_type: str :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ @@ -392,9 +407,10 @@ async def update_tags( :type web_test_name: str :param web_test_tags: Updated tag information to associate with the web test resource. Is either a TagsResource type or a IO[bytes] type. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.models.TagsResource or IO[bytes] + :type web_test_tags: ~azure.mgmt.applicationinsights.v2022_06_15.models.TagsResource or + IO[bytes] :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -408,7 +424,7 @@ async def update_tags( _headers = case_insensitive_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-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) @@ -475,7 +491,7 @@ async def delete(self, resource_group_name: str, web_test_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -507,13 +523,14 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: """Get all Application Insights web test definitions for the specified subscription. :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] :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", "2022-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -536,7 +553,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -577,13 +605,14 @@ def list_by_component( Required. :type resource_group_name: str :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] :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", "2022-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -608,7 +637,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/__init__.py new file mode 100644 index 000000000000..ade03471332c --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + HeaderField, + TagsResource, + WebTest, + WebTestGeolocation, + WebTestListResult, + WebTestPropertiesConfiguration, + WebTestPropertiesRequest, + WebTestPropertiesValidationRules, + WebTestPropertiesValidationRulesContentValidation, + WebtestsResource, +) + +from ._application_insights_management_client_enums import ( # type: ignore + WebTestKind, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "HeaderField", + "TagsResource", + "WebTest", + "WebTestGeolocation", + "WebTestListResult", + "WebTestPropertiesConfiguration", + "WebTestPropertiesRequest", + "WebTestPropertiesValidationRules", + "WebTestPropertiesValidationRulesContentValidation", + "WebtestsResource", + "WebTestKind", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_application_insights_management_client_enums.py new file mode 100644 index 000000000000..7b41c98c1dab --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_application_insights_management_client_enums.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 WebTestKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of WebTest that this web test watches. Choices are ping, multistep and standard.""" + + PING = "ping" + MULTISTEP = "multistep" + STANDARD = "standard" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_models_py3.py new file mode 100644 index 000000000000..3d9458d0e1bf --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_models_py3.py @@ -0,0 +1,511 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, Optional, TYPE_CHECKING, Union + +from .._utils import serialization as _serialization + +if TYPE_CHECKING: + from .. import models as _models + + +class HeaderField(_serialization.Model): + """A header to add to the WebTest. + + :ivar header_field_name: The name of the header. + :vartype header_field_name: str + :ivar header_field_value: The value of the header. + :vartype header_field_value: str + """ + + _attribute_map = { + "header_field_name": {"key": "key", "type": "str"}, + "header_field_value": {"key": "value", "type": "str"}, + } + + def __init__( + self, *, header_field_name: Optional[str] = None, header_field_value: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword header_field_name: The name of the header. + :paramtype header_field_name: str + :keyword header_field_value: The value of the header. + :paramtype header_field_value: str + """ + super().__init__(**kwargs) + self.header_field_name = header_field_name + self.header_field_value = header_field_value + + +class TagsResource(_serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on a + WebTest instance. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class WebtestsResource(_serialization.Model): + """An azure resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.tags = tags + + +class WebTest(WebtestsResource): + """An Application Insights WebTest definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind of WebTest that this web test watches. Choices are ping, multistep and + standard. Known values are: "ping", "multistep", and "standard". + :vartype kind: str or ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestKind + :ivar synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as the + Name field. + :vartype synthetic_monitor_id: str + :ivar web_test_name: User defined name if this WebTest. + :vartype web_test_name: str + :ivar description: User defined description for this WebTest. + :vartype description: str + :ivar enabled: Is the test actively being monitored. + :vartype enabled: bool + :ivar frequency: Interval in seconds between test runs for this WebTest. Default value is 300. + :vartype frequency: int + :ivar timeout: Seconds until this WebTest will timeout and fail. Default value is 30. + :vartype timeout: int + :ivar web_test_kind: The kind of web test this is, valid choices are ping, multistep and + standard. Known values are: "ping", "multistep", and "standard". + :vartype web_test_kind: str or ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestKind + :ivar retry_enabled: Allow for retries should this WebTest fail. + :vartype retry_enabled: bool + :ivar locations: A list of where to physically run the tests from to give global coverage for + accessibility of your application. + :vartype locations: list[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestGeolocation] + :ivar configuration: An XML configuration specification for a WebTest. + :vartype configuration: + ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesConfiguration + :ivar provisioning_state: Current state of this component, whether or not is has been + provisioned within the resource group it is defined. Users cannot change this value but are + able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + :vartype provisioning_state: str + :ivar request: The collection of request properties. + :vartype request: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesRequest + :ivar validation_rules: The collection of validation rule properties. + :vartype validation_rules: + ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRules + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "kind": {"key": "kind", "type": "str"}, + "synthetic_monitor_id": {"key": "properties.SyntheticMonitorId", "type": "str"}, + "web_test_name": {"key": "properties.Name", "type": "str"}, + "description": {"key": "properties.Description", "type": "str"}, + "enabled": {"key": "properties.Enabled", "type": "bool"}, + "frequency": {"key": "properties.Frequency", "type": "int"}, + "timeout": {"key": "properties.Timeout", "type": "int"}, + "web_test_kind": {"key": "properties.Kind", "type": "str"}, + "retry_enabled": {"key": "properties.RetryEnabled", "type": "bool"}, + "locations": {"key": "properties.Locations", "type": "[WebTestGeolocation]"}, + "configuration": {"key": "properties.Configuration", "type": "WebTestPropertiesConfiguration"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "request": {"key": "properties.Request", "type": "WebTestPropertiesRequest"}, + "validation_rules": {"key": "properties.ValidationRules", "type": "WebTestPropertiesValidationRules"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + kind: Optional[Union[str, "_models.WebTestKind"]] = None, + synthetic_monitor_id: Optional[str] = None, + web_test_name: Optional[str] = None, + description: Optional[str] = None, + enabled: Optional[bool] = None, + frequency: int = 300, + timeout: int = 30, + web_test_kind: Optional[Union[str, "_models.WebTestKind"]] = None, + retry_enabled: Optional[bool] = None, + locations: Optional[list["_models.WebTestGeolocation"]] = None, + configuration: Optional["_models.WebTestPropertiesConfiguration"] = None, + request: Optional["_models.WebTestPropertiesRequest"] = None, + validation_rules: Optional["_models.WebTestPropertiesValidationRules"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. Required. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword kind: The kind of WebTest that this web test watches. Choices are ping, multistep and + standard. Known values are: "ping", "multistep", and "standard". + :paramtype kind: str or ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestKind + :keyword synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as + the Name field. + :paramtype synthetic_monitor_id: str + :keyword web_test_name: User defined name if this WebTest. + :paramtype web_test_name: str + :keyword description: User defined description for this WebTest. + :paramtype description: str + :keyword enabled: Is the test actively being monitored. + :paramtype enabled: bool + :keyword frequency: Interval in seconds between test runs for this WebTest. Default value is + 300. + :paramtype frequency: int + :keyword timeout: Seconds until this WebTest will timeout and fail. Default value is 30. + :paramtype timeout: int + :keyword web_test_kind: The kind of web test this is, valid choices are ping, multistep and + standard. Known values are: "ping", "multistep", and "standard". + :paramtype web_test_kind: str or ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestKind + :keyword retry_enabled: Allow for retries should this WebTest fail. + :paramtype retry_enabled: bool + :keyword locations: A list of where to physically run the tests from to give global coverage + for accessibility of your application. + :paramtype locations: + list[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestGeolocation] + :keyword configuration: An XML configuration specification for a WebTest. + :paramtype configuration: + ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesConfiguration + :keyword request: The collection of request properties. + :paramtype request: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesRequest + :keyword validation_rules: The collection of validation rule properties. + :paramtype validation_rules: + ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRules + """ + super().__init__(location=location, tags=tags, **kwargs) + self.kind = kind + self.synthetic_monitor_id = synthetic_monitor_id + self.web_test_name = web_test_name + self.description = description + self.enabled = enabled + self.frequency = frequency + self.timeout = timeout + self.web_test_kind = web_test_kind + self.retry_enabled = retry_enabled + self.locations = locations + self.configuration = configuration + self.provisioning_state: Optional[str] = None + self.request = request + self.validation_rules = validation_rules + + +class WebTestGeolocation(_serialization.Model): + """Geo-physical location to run a WebTest from. You must specify one or more locations for the + test to run from. + + :ivar location: Location ID for the WebTest to run from. + :vartype location: str + """ + + _attribute_map = { + "location": {"key": "Id", "type": "str"}, + } + + def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword location: Location ID for the WebTest to run from. + :paramtype location: str + """ + super().__init__(**kwargs) + self.location = location + + +class WebTestListResult(_serialization.Model): + """A list of 0 or more Application Insights WebTest definitions. + + All required parameters must be populated in order to send to server. + + :ivar value: Set of Application Insights WebTest definitions. Required. + :vartype value: list[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] + :ivar next_link: The link to get the next part of the returned list of WebTest, should the + return set be too large for a single request. May be null. + :vartype next_link: str + """ + + _validation = { + "value": {"required": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[WebTest]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: list["_models.WebTest"], next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: Set of Application Insights WebTest definitions. Required. + :paramtype value: list[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] + :keyword next_link: The link to get the next part of the returned list of WebTest, should the + return set be too large for a single request. May be null. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class WebTestPropertiesConfiguration(_serialization.Model): + """An XML configuration specification for a WebTest. + + :ivar web_test: The XML specification of a WebTest to run against an application. + :vartype web_test: str + """ + + _attribute_map = { + "web_test": {"key": "WebTest", "type": "str"}, + } + + def __init__(self, *, web_test: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword web_test: The XML specification of a WebTest to run against an application. + :paramtype web_test: str + """ + super().__init__(**kwargs) + self.web_test = web_test + + +class WebTestPropertiesRequest(_serialization.Model): + """The collection of request properties. + + :ivar request_url: Url location to test. + :vartype request_url: str + :ivar headers: List of headers and their values to add to the WebTest call. + :vartype headers: list[~azure.mgmt.applicationinsights.v2022_06_15.models.HeaderField] + :ivar http_verb: Http verb to use for this web test. + :vartype http_verb: str + :ivar request_body: Base64 encoded string body to send with this web test. + :vartype request_body: str + :ivar parse_dependent_requests: Parse Dependent request for this WebTest. + :vartype parse_dependent_requests: bool + :ivar follow_redirects: Follow redirects for this web test. + :vartype follow_redirects: bool + """ + + _attribute_map = { + "request_url": {"key": "RequestUrl", "type": "str"}, + "headers": {"key": "Headers", "type": "[HeaderField]"}, + "http_verb": {"key": "HttpVerb", "type": "str"}, + "request_body": {"key": "RequestBody", "type": "str"}, + "parse_dependent_requests": {"key": "ParseDependentRequests", "type": "bool"}, + "follow_redirects": {"key": "FollowRedirects", "type": "bool"}, + } + + def __init__( + self, + *, + request_url: Optional[str] = None, + headers: Optional[list["_models.HeaderField"]] = None, + http_verb: Optional[str] = None, + request_body: Optional[str] = None, + parse_dependent_requests: Optional[bool] = None, + follow_redirects: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword request_url: Url location to test. + :paramtype request_url: str + :keyword headers: List of headers and their values to add to the WebTest call. + :paramtype headers: list[~azure.mgmt.applicationinsights.v2022_06_15.models.HeaderField] + :keyword http_verb: Http verb to use for this web test. + :paramtype http_verb: str + :keyword request_body: Base64 encoded string body to send with this web test. + :paramtype request_body: str + :keyword parse_dependent_requests: Parse Dependent request for this WebTest. + :paramtype parse_dependent_requests: bool + :keyword follow_redirects: Follow redirects for this web test. + :paramtype follow_redirects: bool + """ + super().__init__(**kwargs) + self.request_url = request_url + self.headers = headers + self.http_verb = http_verb + self.request_body = request_body + self.parse_dependent_requests = parse_dependent_requests + self.follow_redirects = follow_redirects + + +class WebTestPropertiesValidationRules(_serialization.Model): + """The collection of validation rule properties. + + :ivar content_validation: The collection of content validation properties. + :vartype content_validation: + ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRulesContentValidation + :ivar ssl_check: Checks to see if the SSL cert is still valid. + :vartype ssl_check: bool + :ivar ssl_cert_remaining_lifetime_check: A number of days to check still remain before the the + existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. + :vartype ssl_cert_remaining_lifetime_check: int + :ivar expected_http_status_code: Validate that the WebTest returns the http status code + provided. + :vartype expected_http_status_code: int + :ivar ignore_http_status_code: When set, validation will ignore the status code. + :vartype ignore_http_status_code: bool + """ + + _attribute_map = { + "content_validation": {"key": "ContentValidation", "type": "WebTestPropertiesValidationRulesContentValidation"}, + "ssl_check": {"key": "SSLCheck", "type": "bool"}, + "ssl_cert_remaining_lifetime_check": {"key": "SSLCertRemainingLifetimeCheck", "type": "int"}, + "expected_http_status_code": {"key": "ExpectedHttpStatusCode", "type": "int"}, + "ignore_http_status_code": {"key": "IgnoreHttpStatusCode", "type": "bool"}, + } + + def __init__( + self, + *, + content_validation: Optional["_models.WebTestPropertiesValidationRulesContentValidation"] = None, + ssl_check: Optional[bool] = None, + ssl_cert_remaining_lifetime_check: Optional[int] = None, + expected_http_status_code: Optional[int] = None, + ignore_http_status_code: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword content_validation: The collection of content validation properties. + :paramtype content_validation: + ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRulesContentValidation + :keyword ssl_check: Checks to see if the SSL cert is still valid. + :paramtype ssl_check: bool + :keyword ssl_cert_remaining_lifetime_check: A number of days to check still remain before the + the existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. + :paramtype ssl_cert_remaining_lifetime_check: int + :keyword expected_http_status_code: Validate that the WebTest returns the http status code + provided. + :paramtype expected_http_status_code: int + :keyword ignore_http_status_code: When set, validation will ignore the status code. + :paramtype ignore_http_status_code: bool + """ + super().__init__(**kwargs) + self.content_validation = content_validation + self.ssl_check = ssl_check + self.ssl_cert_remaining_lifetime_check = ssl_cert_remaining_lifetime_check + self.expected_http_status_code = expected_http_status_code + self.ignore_http_status_code = ignore_http_status_code + + +class WebTestPropertiesValidationRulesContentValidation(_serialization.Model): # pylint: disable=name-too-long + """The collection of content validation properties. + + :ivar content_match: Content to look for in the return of the WebTest. Must not be null or + empty. + :vartype content_match: str + :ivar ignore_case: When set, this value makes the ContentMatch validation case insensitive. + :vartype ignore_case: bool + :ivar pass_if_text_found: When true, validation will pass if there is a match for the + ContentMatch string. If false, validation will fail if there is a match. + :vartype pass_if_text_found: bool + """ + + _attribute_map = { + "content_match": {"key": "ContentMatch", "type": "str"}, + "ignore_case": {"key": "IgnoreCase", "type": "bool"}, + "pass_if_text_found": {"key": "PassIfTextFound", "type": "bool"}, + } + + def __init__( + self, + *, + content_match: Optional[str] = None, + ignore_case: Optional[bool] = None, + pass_if_text_found: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword content_match: Content to look for in the return of the WebTest. Must not be null or + empty. + :paramtype content_match: str + :keyword ignore_case: When set, this value makes the ContentMatch validation case insensitive. + :paramtype ignore_case: bool + :keyword pass_if_text_found: When true, validation will pass if there is a match for the + ContentMatch string. If false, validation will fail if there is a match. + :paramtype pass_if_text_found: bool + """ + super().__init__(**kwargs) + self.content_match = content_match + self.ignore_case = ignore_case + self.pass_if_text_found = pass_if_text_found diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/__init__.py new file mode 100644 index 000000000000..87f6c44f1147 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._web_tests_operations import WebTestsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WebTestsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_web_tests_operations.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_web_tests_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_web_tests_operations.py index 2e8462a2a4da..d0893a4aae7e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_web_tests_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_web_tests_operations.py @@ -8,7 +8,8 @@ # -------------------------------------------------------------------------- from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -31,7 +32,8 @@ from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -260,7 +262,7 @@ class WebTestsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :class:`~azure.mgmt.applicationinsights.v2022_06_15.ApplicationInsightsManagementClient`'s :attr:`web_tests` attribute. """ @@ -283,13 +285,14 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite Required. :type resource_group_name: str :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] :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", "2022-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -313,7 +316,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -352,7 +366,7 @@ def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _m :param web_test_name: The name of the Application Insights WebTest resource. Required. :type web_test_name: str :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -366,7 +380,7 @@ def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) _request = build_get_request( @@ -416,12 +430,12 @@ def create_or_update( :type web_test_name: str :param web_test_definition: Properties that need to be specified to create or update an Application Insights web test definition. Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.models.WebTest + :type web_test_definition: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ @@ -449,7 +463,7 @@ def create_or_update( Default value is "application/json". :paramtype content_type: str :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ @@ -471,9 +485,10 @@ def create_or_update( :param web_test_definition: Properties that need to be specified to create or update an Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.models.WebTest or IO[bytes] + :type web_test_definition: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest or + IO[bytes] :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -487,7 +502,7 @@ def create_or_update( _headers = case_insensitive_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-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) @@ -549,12 +564,12 @@ def update_tags( :type web_test_name: str :param web_test_tags: Updated tag information to associate with the web test resource. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.models.TagsResource + :type web_test_tags: ~azure.mgmt.applicationinsights.v2022_06_15.models.TagsResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ @@ -582,7 +597,7 @@ def update_tags( Default value is "application/json". :paramtype content_type: str :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ @@ -603,9 +618,10 @@ def update_tags( :type web_test_name: str :param web_test_tags: Updated tag information to associate with the web test resource. Is either a TagsResource type or a IO[bytes] type. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.models.TagsResource or IO[bytes] + :type web_test_tags: ~azure.mgmt.applicationinsights.v2022_06_15.models.TagsResource or + IO[bytes] :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -619,7 +635,7 @@ def update_tags( _headers = case_insensitive_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-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) @@ -688,7 +704,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _request = build_delete_request( @@ -720,13 +736,14 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.WebTest"]: """Get all Application Insights web test definitions for the specified subscription. :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] :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", "2022-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -749,7 +766,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -790,13 +818,14 @@ def list_by_component( Required. :type resource_group_name: str :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] :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", "2022-06-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -821,7 +850,18 @@ def prepare_request(next_link=None): _request.url = self._client.format_url(_request.url) else: - _request = HttpRequest("GET", next_link) + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/code_report_swagger.json b/sdk/applicationinsights/azure-mgmt-applicationinsights/code_report_swagger.json new file mode 100644 index 000000000000..a4402202e6fe --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/code_report_swagger.json @@ -0,0 +1,46938 @@ +{ + "azure.mgmt.applicationinsights": { + "class_nodes": {}, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2022_04_01": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "workbooks": { + "attr_type": "WorkbooksOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2022_04_01.operations": { + "class_nodes": { + "WorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "revision_get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "revision_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "revisions_list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[WorkbookUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2022_04_01.models": { + "class_nodes": { + "CategoryType": { + "type": "Enum", + "methods": {}, + "properties": { + "PERFORMANCE": "PERFORMANCE", + "RETENTION": "RETENTION", + "TSG": "TSG", + "WORKBOOK": "WORKBOOK", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "CreatedByType": { + "type": "Enum", + "methods": {}, + "properties": { + "APPLICATION": "APPLICATION", + "KEY": "KEY", + "MANAGED_IDENTITY": "MANAGED_IDENTITY", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ManagedServiceIdentity": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "type": { + "default": null, + "param_type": "keyword_only" + }, + "user_assigned_identities": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "principal_id": { + "attr_type": null + }, + "tenant_id": { + "attr_type": null + }, + "type": { + "attr_type": "type" + }, + "user_assigned_identities": { + "attr_type": "user_assigned_identities" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ManagedServiceIdentityType": { + "type": "Enum", + "methods": {}, + "properties": { + "NONE": "NONE", + "SYSTEM_ASSIGNED": "SYSTEM_ASSIGNED", + "SYSTEM_ASSIGNED_USER_ASSIGNED": "SYSTEM_ASSIGNED_USER_ASSIGNED", + "USER_ASSIGNED": "USER_ASSIGNED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "Resource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "SystemData": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "created_by": { + "default": "none", + "param_type": "keyword_only" + }, + "created_by_type": { + "default": "none", + "param_type": "keyword_only" + }, + "created_at": { + "default": "none", + "param_type": "keyword_only" + }, + "last_modified_by": { + "default": "none", + "param_type": "keyword_only" + }, + "last_modified_by_type": { + "default": "none", + "param_type": "keyword_only" + }, + "last_modified_at": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "created_by": { + "attr_type": "created_by" + }, + "created_by_type": { + "attr_type": "created_by_type" + }, + "created_at": { + "attr_type": "created_at" + }, + "last_modified_by": { + "attr_type": "last_modified_by" + }, + "last_modified_by_type": { + "attr_type": "last_modified_by_type" + }, + "last_modified_at": { + "attr_type": "last_modified_at" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "TrackedResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": { + "attr_type": "tags" + }, + "location": { + "attr_type": "location" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "UserAssignedIdentity": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "principal_id": { + "attr_type": null + }, + "client_id": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "Workbook": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "identity": { + "default": "none", + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "etag": { + "default": "none", + "param_type": "keyword_only" + }, + "display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "serialized_data": { + "default": "none", + "param_type": "keyword_only" + }, + "version": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "tags_properties_tags": { + "default": "none", + "param_type": "keyword_only" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "storage_uri": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "system_data": { + "attr_type": null + }, + "display_name": { + "attr_type": "display_name" + }, + "serialized_data": { + "attr_type": "serialized_data" + }, + "version": { + "attr_type": "version" + }, + "time_modified": { + "attr_type": null + }, + "category": { + "attr_type": "category" + }, + "tags_properties_tags": { + "attr_type": "tags_properties_tags" + }, + "user_id": { + "attr_type": null + }, + "source_id": { + "attr_type": "source_id" + }, + "storage_uri": { + "attr_type": "storage_uri" + }, + "description": { + "attr_type": "description" + }, + "revision": { + "attr_type": null + }, + "identity": { + "attr_type": "identity" + }, + "kind": { + "attr_type": "kind" + }, + "etag": { + "attr_type": "etag" + }, + "tags": { + "attr_type": "tags" + }, + "location": { + "attr_type": "location" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": { + "attr_type": "error" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookErrorDefinition": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": null + }, + "message": { + "attr_type": null + }, + "innererror": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookInnerErrorTrace": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "trace": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "identity": { + "default": "none", + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "etag": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "identity": { + "attr_type": "identity" + }, + "kind": { + "attr_type": "kind" + }, + "etag": { + "attr_type": "etag" + }, + "tags": { + "attr_type": "tags" + }, + "location": { + "attr_type": "location" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookResourceIdentity": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "type": { + "default": null, + "param_type": "keyword_only" + }, + "user_assigned_identities": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "principal_id": { + "attr_type": null + }, + "tenant_id": { + "attr_type": null + }, + "type": { + "attr_type": "type" + }, + "user_assigned_identities": { + "attr_type": "user_assigned_identities" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookSharedTypeKind": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "WorkbookUpdateParameters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "serialized_data": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "tags_properties_tags": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "revision": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "tags": { + "attr_type": "tags" + }, + "display_name": { + "attr_type": "display_name" + }, + "serialized_data": { + "attr_type": "serialized_data" + }, + "category": { + "attr_type": "category" + }, + "tags_properties_tags": { + "attr_type": "tags_properties_tags" + }, + "description": { + "attr_type": "description" + }, + "revision": { + "attr_type": "revision" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookUpdateSharedTypeKind": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "WorkbooksListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": null + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2022_04_01.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "workbooks": { + "attr_type": "WorkbooksOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2022_04_01.aio.operations": { + "class_nodes": { + "WorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "revision_get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "revision_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "revisions_list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[WorkbookUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2018_06_17_preview": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "workbooks": { + "attr_type": "WorkbooksOperations" + }, + "operations": { + "attr_type": "Operations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2018_06_17_preview.operations": { + "class_nodes": { + "Operations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "WorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[WorkbookUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2018_06_17_preview.models": { + "class_nodes": { + "CategoryType": { + "type": "Enum", + "methods": {}, + "properties": { + "PERFORMANCE": "PERFORMANCE", + "RETENTION": "RETENTION", + "TSG": "TSG", + "WORKBOOK": "WORKBOOK", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ErrorFieldContract": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "target": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "target": { + "attr_type": "target" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "Operation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "display": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "display": { + "attr_type": "display" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationDisplay": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "provider": { + "default": "none", + "param_type": "keyword_only" + }, + "resource": { + "default": "none", + "param_type": "keyword_only" + }, + "operation": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "provider": { + "attr_type": "provider" + }, + "resource": { + "attr_type": "resource" + }, + "operation": { + "attr_type": "operation" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "Resource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "kind": { + "attr_type": "kind" + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "SharedTypeKind": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "Workbook": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "serialized_data": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "version": { + "default": "none", + "param_type": "keyword_only" + }, + "tags_properties_tags": { + "default": "none", + "param_type": "keyword_only" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "display_name": { + "attr_type": "display_name" + }, + "serialized_data": { + "attr_type": "serialized_data" + }, + "time_modified": { + "attr_type": null + }, + "category": { + "attr_type": "category" + }, + "version": { + "attr_type": "version" + }, + "tags_properties_tags": { + "attr_type": "tags_properties_tags" + }, + "user_id": { + "attr_type": null + }, + "source_id": { + "attr_type": "source_id" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "kind": { + "attr_type": "kind" + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "details": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "details": { + "attr_type": "details" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookUpdateParameters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "serialized_data": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "tags_properties_tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "tags": { + "attr_type": "tags" + }, + "display_name": { + "attr_type": "display_name" + }, + "serialized_data": { + "attr_type": "serialized_data" + }, + "category": { + "attr_type": "category" + }, + "tags_properties_tags": { + "attr_type": "tags_properties_tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbooksListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2018_06_17_preview.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "workbooks": { + "attr_type": "WorkbooksOperations" + }, + "operations": { + "attr_type": "Operations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2018_06_17_preview.aio.operations": { + "class_nodes": { + "Operations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "WorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[WorkbookUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_02_02_preview": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "components": { + "attr_type": "ComponentsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_02_02_preview.operations": { + "class_nodes": { + "ComponentsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "ApplicationInsightsComponent", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get_purge_status": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "purge_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "purge": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "ComponentPurgeBody", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_02_02_preview.models": { + "class_nodes": { + "ApplicationInsightsComponent": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "etag": { + "default": "none", + "param_type": "keyword_only" + }, + "application_type": { + "default": "str", + "param_type": "keyword_only" + }, + "flow_type": { + "default": "str", + "param_type": "keyword_only" + }, + "request_source": { + "default": "str", + "param_type": "keyword_only" + }, + "hockey_app_id": { + "default": "none", + "param_type": "keyword_only" + }, + "sampling_percentage": { + "default": "none", + "param_type": "keyword_only" + }, + "disable_ip_masking": { + "default": "none", + "param_type": "keyword_only" + }, + "immediate_purge_data_on30_days": { + "default": "none", + "param_type": "keyword_only" + }, + "workspace_resource_id": { + "default": "none", + "param_type": "keyword_only" + }, + "public_network_access_for_ingestion": { + "default": "str", + "param_type": "keyword_only" + }, + "public_network_access_for_query": { + "default": "str", + "param_type": "keyword_only" + }, + "ingestion_mode": { + "default": "str", + "param_type": "keyword_only" + }, + "disable_local_auth": { + "default": "none", + "param_type": "keyword_only" + }, + "force_customer_storage_for_profiler": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "etag": { + "attr_type": "etag" + }, + "application_id": { + "attr_type": null + }, + "app_id": { + "attr_type": null + }, + "name_properties_name": { + "attr_type": null + }, + "application_type": { + "attr_type": "application_type" + }, + "flow_type": { + "attr_type": "flow_type" + }, + "request_source": { + "attr_type": "request_source" + }, + "instrumentation_key": { + "attr_type": null + }, + "creation_date": { + "attr_type": null + }, + "tenant_id": { + "attr_type": null + }, + "hockey_app_id": { + "attr_type": "hockey_app_id" + }, + "hockey_app_token": { + "attr_type": null + }, + "provisioning_state": { + "attr_type": null + }, + "sampling_percentage": { + "attr_type": "sampling_percentage" + }, + "connection_string": { + "attr_type": null + }, + "retention_in_days": { + "attr_type": null + }, + "disable_ip_masking": { + "attr_type": "disable_ip_masking" + }, + "immediate_purge_data_on30_days": { + "attr_type": "immediate_purge_data_on30_days" + }, + "workspace_resource_id": { + "attr_type": "workspace_resource_id" + }, + "la_migration_date": { + "attr_type": null + }, + "private_link_scoped_resources": { + "attr_type": null + }, + "public_network_access_for_ingestion": { + "attr_type": "public_network_access_for_ingestion" + }, + "public_network_access_for_query": { + "attr_type": "public_network_access_for_query" + }, + "ingestion_mode": { + "attr_type": "ingestion_mode" + }, + "disable_local_auth": { + "attr_type": "disable_local_auth" + }, + "force_customer_storage_for_profiler": { + "attr_type": "force_customer_storage_for_profiler" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": null, + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationType": { + "type": "Enum", + "methods": {}, + "properties": { + "OTHER": "OTHER", + "WEB": "WEB", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ComponentPurgeBody": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "table": { + "default": null, + "param_type": "keyword_only" + }, + "filters": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "table": { + "attr_type": "table" + }, + "filters": { + "attr_type": "filters" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeBodyFilters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "column": { + "default": "none", + "param_type": "keyword_only" + }, + "operator": { + "default": "none", + "param_type": "keyword_only" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "key": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "column": { + "attr_type": "column" + }, + "operator": { + "attr_type": "operator" + }, + "value": { + "attr_type": "value" + }, + "key": { + "attr_type": "key" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "operation_id": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "operation_id": { + "attr_type": "operation_id" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeStatusResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "status": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "status": { + "attr_type": "status" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorAdditionalInfo": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "type": { + "attr_type": null + }, + "info": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorDetail": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": null + }, + "message": { + "attr_type": null + }, + "target": { + "attr_type": null + }, + "details": { + "attr_type": null + }, + "additional_info": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": { + "attr_type": "error" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "FlowType": { + "type": "Enum", + "methods": {}, + "properties": { + "BLUEFIELD": "BLUEFIELD", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "IngestionMode": { + "type": "Enum", + "methods": {}, + "properties": { + "APPLICATION_INSIGHTS": "APPLICATION_INSIGHTS", + "APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS": "APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS", + "LOG_ANALYTICS": "LOG_ANALYTICS", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "PrivateLinkScopedResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_id": { + "default": "none", + "param_type": "keyword_only" + }, + "scope_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "resource_id": { + "attr_type": "resource_id" + }, + "scope_id": { + "attr_type": "scope_id" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "PublicNetworkAccessType": { + "type": "Enum", + "methods": {}, + "properties": { + "DISABLED": "DISABLED", + "ENABLED": "ENABLED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "PurgeState": { + "type": "Enum", + "methods": {}, + "properties": { + "COMPLETED": "COMPLETED", + "PENDING": "PENDING", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "RequestSource": { + "type": "Enum", + "methods": {}, + "properties": { + "REST": "REST", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "TagsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_02_02_preview.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "components": { + "attr_type": "ComponentsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_02_02_preview.aio.operations": { + "class_nodes": { + "ComponentsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "ApplicationInsightsComponent", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get_purge_status": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "purge_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "purge": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "ComponentPurgeBody", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2018_05_01_preview": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "proactive_detection_configurations": { + "attr_type": "ProactiveDetectionConfigurationsOperations" + }, + "components": { + "attr_type": "ComponentsOperations" + }, + "operations": { + "attr_type": "Operations" + }, + "web_tests": { + "attr_type": "WebTestsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2018_05_01_preview.operations": { + "class_nodes": { + "ComponentsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "ApplicationInsightsComponent", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get_purge_status": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "purge_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "purge": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "ComponentPurgeBody", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "Operations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ProactiveDetectionConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "ApplicationInsightsComponentProactiveDetectionConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WebTestsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "WebTest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_component": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2018_05_01_preview.models": { + "class_nodes": { + "ApplicationInsightsComponent": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "application_type": { + "default": "str", + "param_type": "keyword_only" + }, + "flow_type": { + "default": "str", + "param_type": "keyword_only" + }, + "request_source": { + "default": "str", + "param_type": "keyword_only" + }, + "hockey_app_id": { + "default": "none", + "param_type": "keyword_only" + }, + "sampling_percentage": { + "default": "none", + "param_type": "keyword_only" + }, + "retention_in_days": { + "default": "int", + "param_type": "keyword_only" + }, + "disable_ip_masking": { + "default": "none", + "param_type": "keyword_only" + }, + "immediate_purge_data_on30_days": { + "default": "none", + "param_type": "keyword_only" + }, + "public_network_access_for_ingestion": { + "default": "str", + "param_type": "keyword_only" + }, + "public_network_access_for_query": { + "default": "str", + "param_type": "keyword_only" + }, + "ingestion_mode": { + "default": "str", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "application_id": { + "attr_type": null + }, + "app_id": { + "attr_type": null + }, + "application_type": { + "attr_type": "application_type" + }, + "flow_type": { + "attr_type": "flow_type" + }, + "request_source": { + "attr_type": "request_source" + }, + "instrumentation_key": { + "attr_type": null + }, + "creation_date": { + "attr_type": null + }, + "tenant_id": { + "attr_type": null + }, + "hockey_app_id": { + "attr_type": "hockey_app_id" + }, + "hockey_app_token": { + "attr_type": null + }, + "provisioning_state": { + "attr_type": null + }, + "sampling_percentage": { + "attr_type": "sampling_percentage" + }, + "connection_string": { + "attr_type": null + }, + "retention_in_days": { + "attr_type": "retention_in_days" + }, + "disable_ip_masking": { + "attr_type": "disable_ip_masking" + }, + "immediate_purge_data_on30_days": { + "attr_type": "immediate_purge_data_on30_days" + }, + "private_link_scoped_resources": { + "attr_type": null + }, + "public_network_access_for_ingestion": { + "attr_type": "public_network_access_for_ingestion" + }, + "public_network_access_for_query": { + "attr_type": "public_network_access_for_query" + }, + "ingestion_mode": { + "attr_type": "ingestion_mode" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": null, + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentProactiveDetectionConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "location": { + "default": "none", + "param_type": "keyword_only" + }, + "enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "send_emails_to_subscription_owners": { + "default": "none", + "param_type": "keyword_only" + }, + "custom_emails": { + "default": "none", + "param_type": "keyword_only" + }, + "rule_definitions": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": "name" + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "name_properties_name": { + "attr_type": null + }, + "enabled": { + "attr_type": "enabled" + }, + "send_emails_to_subscription_owners": { + "attr_type": "send_emails_to_subscription_owners" + }, + "custom_emails": { + "attr_type": "custom_emails" + }, + "last_updated_time": { + "attr_type": null + }, + "rule_definitions": { + "attr_type": "rule_definitions" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "help_url": { + "default": "none", + "param_type": "keyword_only" + }, + "is_hidden": { + "default": "none", + "param_type": "keyword_only" + }, + "is_enabled_by_default": { + "default": "none", + "param_type": "keyword_only" + }, + "is_in_preview": { + "default": "none", + "param_type": "keyword_only" + }, + "supports_email_notifications": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "display_name": { + "attr_type": "display_name" + }, + "description": { + "attr_type": "description" + }, + "help_url": { + "attr_type": "help_url" + }, + "is_hidden": { + "attr_type": "is_hidden" + }, + "is_enabled_by_default": { + "attr_type": "is_enabled_by_default" + }, + "is_in_preview": { + "attr_type": "is_in_preview" + }, + "supports_email_notifications": { + "attr_type": "supports_email_notifications" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationType": { + "type": "Enum", + "methods": {}, + "properties": { + "OTHER": "OTHER", + "WEB": "WEB", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ComponentPurgeBody": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "table": { + "default": null, + "param_type": "keyword_only" + }, + "filters": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "table": { + "attr_type": "table" + }, + "filters": { + "attr_type": "filters" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeBodyFilters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "column": { + "default": "none", + "param_type": "keyword_only" + }, + "operator": { + "default": "none", + "param_type": "keyword_only" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "key": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "column": { + "attr_type": "column" + }, + "operator": { + "attr_type": "operator" + }, + "value": { + "attr_type": "value" + }, + "key": { + "attr_type": "key" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "operation_id": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "operation_id": { + "attr_type": "operation_id" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeStatusResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "status": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "status": { + "attr_type": "status" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "FlowType": { + "type": "Enum", + "methods": {}, + "properties": { + "BLUEFIELD": "BLUEFIELD", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "HeaderField": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "header_field_name": { + "default": "none", + "param_type": "keyword_only" + }, + "header_field_value": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "header_field_name": { + "attr_type": "header_field_name" + }, + "header_field_value": { + "attr_type": "header_field_value" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "IngestionMode": { + "type": "Enum", + "methods": {}, + "properties": { + "APPLICATION_INSIGHTS": "APPLICATION_INSIGHTS", + "APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS": "APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS", + "LOG_ANALYTICS": "LOG_ANALYTICS", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "Operation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "display": { + "default": "none", + "param_type": "keyword_only" + }, + "origin": { + "default": "none", + "param_type": "keyword_only" + }, + "properties": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "display": { + "attr_type": "display" + }, + "origin": { + "attr_type": "origin" + }, + "properties": { + "attr_type": "properties" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationInfo": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "provider": { + "default": "none", + "param_type": "keyword_only" + }, + "resource": { + "default": "none", + "param_type": "keyword_only" + }, + "operation": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "provider": { + "attr_type": "provider" + }, + "resource": { + "attr_type": "resource" + }, + "operation": { + "attr_type": "operation" + }, + "description": { + "attr_type": "description" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationsListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "PrivateLinkScopedResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_id": { + "default": "none", + "param_type": "keyword_only" + }, + "scope_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "resource_id": { + "attr_type": "resource_id" + }, + "scope_id": { + "attr_type": "scope_id" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "PublicNetworkAccessType": { + "type": "Enum", + "methods": {}, + "properties": { + "DISABLED": "DISABLED", + "ENABLED": "ENABLED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "PurgeState": { + "type": "Enum", + "methods": {}, + "properties": { + "COMPLETED": "COMPLETED", + "PENDING": "PENDING", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "RequestSource": { + "type": "Enum", + "methods": {}, + "properties": { + "REST": "REST", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "TagsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kind": { + "default": "str", + "param_type": "keyword_only" + }, + "synthetic_monitor_id": { + "default": "none", + "param_type": "keyword_only" + }, + "web_test_name": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "frequency": { + "default": "int", + "param_type": "keyword_only" + }, + "timeout": { + "default": "int", + "param_type": "keyword_only" + }, + "web_test_kind": { + "default": "str", + "param_type": "keyword_only" + }, + "retry_enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "locations": { + "default": "none", + "param_type": "keyword_only" + }, + "configuration": { + "default": "none", + "param_type": "keyword_only" + }, + "request": { + "default": "none", + "param_type": "keyword_only" + }, + "validation_rules": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "synthetic_monitor_id": { + "attr_type": "synthetic_monitor_id" + }, + "web_test_name": { + "attr_type": "web_test_name" + }, + "description": { + "attr_type": "description" + }, + "enabled": { + "attr_type": "enabled" + }, + "frequency": { + "attr_type": "frequency" + }, + "timeout": { + "attr_type": "timeout" + }, + "web_test_kind": { + "attr_type": "web_test_kind" + }, + "retry_enabled": { + "attr_type": "retry_enabled" + }, + "locations": { + "attr_type": "locations" + }, + "configuration": { + "attr_type": "configuration" + }, + "provisioning_state": { + "attr_type": null + }, + "request": { + "attr_type": "request" + }, + "validation_rules": { + "attr_type": "validation_rules" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestGeolocation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "location": { + "attr_type": "location" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestKind": { + "type": "Enum", + "methods": {}, + "properties": { + "MULTISTEP": "MULTISTEP", + "PING": "PING", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "WebTestKindEnum": { + "type": "Enum", + "methods": {}, + "properties": { + "BASIC": "BASIC", + "MULTISTEP": "MULTISTEP", + "PING": "PING", + "STANDARD": "STANDARD", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "WebTestListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": null, + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestPropertiesConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "web_test": { + "attr_type": "web_test" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestPropertiesRequest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "request_url": { + "default": "none", + "param_type": "keyword_only" + }, + "headers": { + "default": "none", + "param_type": "keyword_only" + }, + "http_verb": { + "default": "none", + "param_type": "keyword_only" + }, + "request_body": { + "default": "none", + "param_type": "keyword_only" + }, + "parse_dependent_requests": { + "default": "none", + "param_type": "keyword_only" + }, + "follow_redirects": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "request_url": { + "attr_type": "request_url" + }, + "headers": { + "attr_type": "headers" + }, + "http_verb": { + "attr_type": "http_verb" + }, + "request_body": { + "attr_type": "request_body" + }, + "parse_dependent_requests": { + "attr_type": "parse_dependent_requests" + }, + "follow_redirects": { + "attr_type": "follow_redirects" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestPropertiesValidationRules": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_validation": { + "default": "none", + "param_type": "keyword_only" + }, + "ssl_check": { + "default": "none", + "param_type": "keyword_only" + }, + "ssl_cert_remaining_lifetime_check": { + "default": "none", + "param_type": "keyword_only" + }, + "expected_http_status_code": { + "default": "none", + "param_type": "keyword_only" + }, + "ignore_https_status_code": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "content_validation": { + "attr_type": "content_validation" + }, + "ssl_check": { + "attr_type": "ssl_check" + }, + "ssl_cert_remaining_lifetime_check": { + "attr_type": "ssl_cert_remaining_lifetime_check" + }, + "expected_http_status_code": { + "attr_type": "expected_http_status_code" + }, + "ignore_https_status_code": { + "attr_type": "ignore_https_status_code" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestPropertiesValidationRulesContentValidation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_match": { + "default": "none", + "param_type": "keyword_only" + }, + "ignore_case": { + "default": "none", + "param_type": "keyword_only" + }, + "pass_if_text_found": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "content_match": { + "attr_type": "content_match" + }, + "ignore_case": { + "attr_type": "ignore_case" + }, + "pass_if_text_found": { + "attr_type": "pass_if_text_found" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebtestsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2018_05_01_preview.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "proactive_detection_configurations": { + "attr_type": "ProactiveDetectionConfigurationsOperations" + }, + "components": { + "attr_type": "ComponentsOperations" + }, + "operations": { + "attr_type": "Operations" + }, + "web_tests": { + "attr_type": "WebTestsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2018_05_01_preview.aio.operations": { + "class_nodes": { + "ComponentsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "ApplicationInsightsComponent", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get_purge_status": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "purge_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "purge": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "ComponentPurgeBody", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "Operations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ProactiveDetectionConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "ApplicationInsightsComponentProactiveDetectionConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WebTestsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "WebTest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_component": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_11_20": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "workbook_templates": { + "attr_type": "WorkbookTemplatesOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_11_20.operations": { + "class_nodes": { + "WorkbookTemplatesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "WorkbookTemplate", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[WorkbookTemplateUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_11_20.models": { + "class_nodes": { + "WorkbookTemplate": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "priority": { + "default": "none", + "param_type": "keyword_only" + }, + "author": { + "default": "none", + "param_type": "keyword_only" + }, + "template_data": { + "default": "none", + "param_type": "keyword_only" + }, + "galleries": { + "default": "none", + "param_type": "keyword_only" + }, + "localized": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "priority": { + "attr_type": "priority" + }, + "author": { + "attr_type": "author" + }, + "template_data": { + "attr_type": "template_data" + }, + "galleries": { + "attr_type": "galleries" + }, + "localized": { + "attr_type": "localized" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": { + "attr_type": "error" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateErrorBody": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "details": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "details": { + "attr_type": "details" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateErrorFieldContract": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "target": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "target": { + "attr_type": "target" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateGallery": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "type": { + "default": "none", + "param_type": "keyword_only" + }, + "order": { + "default": "none", + "param_type": "keyword_only" + }, + "resource_type": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "category": { + "attr_type": "category" + }, + "type": { + "attr_type": "type" + }, + "order": { + "attr_type": "order" + }, + "resource_type": { + "attr_type": "resource_type" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateLocalizedGallery": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "template_data": { + "default": "none", + "param_type": "keyword_only" + }, + "galleries": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "template_data": { + "attr_type": "template_data" + }, + "galleries": { + "attr_type": "galleries" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateUpdateParameters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "priority": { + "default": "none", + "param_type": "keyword_only" + }, + "author": { + "default": "none", + "param_type": "keyword_only" + }, + "template_data": { + "default": "none", + "param_type": "keyword_only" + }, + "galleries": { + "default": "none", + "param_type": "keyword_only" + }, + "localized": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": { + "attr_type": "tags" + }, + "priority": { + "attr_type": "priority" + }, + "author": { + "attr_type": "author" + }, + "template_data": { + "attr_type": "template_data" + }, + "galleries": { + "attr_type": "galleries" + }, + "localized": { + "attr_type": "localized" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplatesListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_11_20.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "workbook_templates": { + "attr_type": "WorkbookTemplatesOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_11_20.aio.operations": { + "class_nodes": { + "WorkbookTemplatesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "WorkbookTemplate", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[WorkbookTemplateUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2017_10_01": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "ea_subscription_migrate_to_new_pricing_model": { + "attr_type": "EASubscriptionMigrateToNewPricingModelOperations" + }, + "ea_subscription_rollback_to_legacy_pricing_model": { + "attr_type": "EASubscriptionRollbackToLegacyPricingModelOperations" + }, + "ea_subscription_list_migration_date": { + "attr_type": "EASubscriptionListMigrationDateOperations" + }, + "component_current_pricing_plan": { + "attr_type": "ComponentCurrentPricingPlanOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2017_10_01.operations": { + "class_nodes": { + "ComponentCurrentPricingPlanOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_and_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "type": "ApplicationInsightsComponentPricingPlan", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "type": "ApplicationInsightsComponentPricingPlan", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "EASubscriptionListMigrationDateOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "post": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "EASubscriptionMigrateToNewPricingModelOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "post": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "EASubscriptionRollbackToLegacyPricingModelOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "post": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2017_10_01.models": { + "class_nodes": { + "ApplicationInsightsComponentPricingPlan": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "plan_type": { + "default": "none", + "param_type": "keyword_only" + }, + "cap": { + "default": "none", + "param_type": "keyword_only" + }, + "warning_threshold": { + "default": "none", + "param_type": "keyword_only" + }, + "stop_send_notification_when_hit_threshold": { + "default": "none", + "param_type": "keyword_only" + }, + "stop_send_notification_when_hit_cap": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "plan_type": { + "attr_type": "plan_type" + }, + "cap": { + "attr_type": "cap" + }, + "reset_hour": { + "attr_type": null + }, + "warning_threshold": { + "attr_type": "warning_threshold" + }, + "stop_send_notification_when_hit_threshold": { + "attr_type": "stop_send_notification_when_hit_threshold" + }, + "stop_send_notification_when_hit_cap": { + "attr_type": "stop_send_notification_when_hit_cap" + }, + "max_history_cap": { + "attr_type": null + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "CloudErrorBody": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "target": { + "default": "none", + "param_type": "keyword_only" + }, + "details": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "target": { + "attr_type": "target" + }, + "details": { + "attr_type": "details" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "EASubscriptionMigrationDate": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "is_grand_fatherable_subscription": { + "default": "none", + "param_type": "keyword_only" + }, + "opted_in_date": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "is_grand_fatherable_subscription": { + "attr_type": "is_grand_fatherable_subscription" + }, + "opted_in_date": { + "attr_type": "opted_in_date" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "Resource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2017_10_01.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "ea_subscription_migrate_to_new_pricing_model": { + "attr_type": "EASubscriptionMigrateToNewPricingModelOperations" + }, + "ea_subscription_rollback_to_legacy_pricing_model": { + "attr_type": "EASubscriptionRollbackToLegacyPricingModelOperations" + }, + "ea_subscription_list_migration_date": { + "attr_type": "EASubscriptionListMigrationDateOperations" + }, + "component_current_pricing_plan": { + "attr_type": "ComponentCurrentPricingPlanOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2017_10_01.aio.operations": { + "class_nodes": { + "ComponentCurrentPricingPlanOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_and_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "type": "ApplicationInsightsComponentPricingPlan", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "type": "ApplicationInsightsComponentPricingPlan", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "pricing_plan_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "EASubscriptionListMigrationDateOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "post": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + }, + "EASubscriptionMigrateToNewPricingModelOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "post": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + }, + "EASubscriptionRollbackToLegacyPricingModelOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "post": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_03_08": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "my_workbooks": { + "attr_type": "MyWorkbooksOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_03_08.operations": { + "class_nodes": { + "MyWorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "MyWorkbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "MyWorkbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_03_08.models": { + "class_nodes": { + "CategoryType": { + "type": "Enum", + "methods": {}, + "properties": { + "PERFORMANCE": "PERFORMANCE", + "RETENTION": "RETENTION", + "TSG": "TSG", + "WORKBOOK": "WORKBOOK", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "CreatedByType": { + "type": "Enum", + "methods": {}, + "properties": { + "APPLICATION": "APPLICATION", + "KEY": "KEY", + "MANAGED_IDENTITY": "MANAGED_IDENTITY", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ErrorDefinition": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": null + }, + "message": { + "attr_type": null + }, + "innererror": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "InnerErrorTrace": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "trace": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "Kind": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "MyWorkbook": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "identity": { + "default": "none", + "param_type": "keyword_only" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "type": { + "default": "none", + "param_type": "keyword_only" + }, + "location": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "etag": { + "default": "none", + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "serialized_data": { + "default": "none", + "param_type": "keyword_only" + }, + "version": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "tags_properties_tags": { + "default": "none", + "param_type": "keyword_only" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "storage_uri": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "system_data": { + "attr_type": null + }, + "display_name": { + "attr_type": "display_name" + }, + "serialized_data": { + "attr_type": "serialized_data" + }, + "version": { + "attr_type": "version" + }, + "time_modified": { + "attr_type": null + }, + "category": { + "attr_type": "category" + }, + "tags_properties_tags": { + "attr_type": "tags_properties_tags" + }, + "user_id": { + "attr_type": null + }, + "source_id": { + "attr_type": "source_id" + }, + "storage_uri": { + "attr_type": "storage_uri" + }, + "identity": { + "attr_type": "identity" + }, + "id": { + "attr_type": "id" + }, + "name": { + "attr_type": "name" + }, + "type": { + "attr_type": "type" + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "etag": { + "attr_type": "etag" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "MyWorkbookError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": { + "attr_type": "error" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "MyWorkbookManagedIdentity": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "user_assigned_identities": { + "default": "none", + "param_type": "keyword_only" + }, + "type": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "user_assigned_identities": { + "attr_type": "user_assigned_identities" + }, + "type": { + "attr_type": "type" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "MyWorkbookManagedIdentityType": { + "type": "Enum", + "methods": {}, + "properties": { + "NONE": "NONE", + "USER_ASSIGNED": "USER_ASSIGNED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "MyWorkbookResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "identity": { + "default": "none", + "param_type": "keyword_only" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "type": { + "default": "none", + "param_type": "keyword_only" + }, + "location": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "etag": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "identity": { + "attr_type": "identity" + }, + "id": { + "attr_type": "id" + }, + "name": { + "attr_type": "name" + }, + "type": { + "attr_type": "type" + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "etag": { + "attr_type": "etag" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "MyWorkbookUserAssignedIdentities": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "principal_id": { + "attr_type": null + }, + "tenant_id": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "MyWorkbooksListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": null + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "SystemData": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "created_by": { + "default": "none", + "param_type": "keyword_only" + }, + "created_by_type": { + "default": "none", + "param_type": "keyword_only" + }, + "created_at": { + "default": "none", + "param_type": "keyword_only" + }, + "last_modified_by": { + "default": "none", + "param_type": "keyword_only" + }, + "last_modified_by_type": { + "default": "none", + "param_type": "keyword_only" + }, + "last_modified_at": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "created_by": { + "attr_type": "created_by" + }, + "created_by_type": { + "attr_type": "created_by_type" + }, + "created_at": { + "attr_type": "created_at" + }, + "last_modified_by": { + "attr_type": "last_modified_by" + }, + "last_modified_by_type": { + "attr_type": "last_modified_by_type" + }, + "last_modified_at": { + "attr_type": "last_modified_at" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_03_08.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "my_workbooks": { + "attr_type": "MyWorkbooksOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_03_08.aio.operations": { + "class_nodes": { + "MyWorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "MyWorkbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "MyWorkbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_08_01": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "workbooks": { + "attr_type": "WorkbooksOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_08_01.operations": { + "class_nodes": { + "WorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "revision_get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "revision_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "revisions_list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[WorkbookUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_08_01.models": { + "class_nodes": { + "CategoryType": { + "type": "Enum", + "methods": {}, + "properties": { + "PERFORMANCE": "PERFORMANCE", + "RETENTION": "RETENTION", + "TSG": "TSG", + "WORKBOOK": "WORKBOOK", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "CreatedByType": { + "type": "Enum", + "methods": {}, + "properties": { + "APPLICATION": "APPLICATION", + "KEY": "KEY", + "MANAGED_IDENTITY": "MANAGED_IDENTITY", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "Kind": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ManagedServiceIdentity": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "type": { + "default": null, + "param_type": "keyword_only" + }, + "user_assigned_identities": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "principal_id": { + "attr_type": null + }, + "tenant_id": { + "attr_type": null + }, + "type": { + "attr_type": "type" + }, + "user_assigned_identities": { + "attr_type": "user_assigned_identities" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ManagedServiceIdentityType": { + "type": "Enum", + "methods": {}, + "properties": { + "NONE": "NONE", + "SYSTEM_ASSIGNED": "SYSTEM_ASSIGNED", + "SYSTEM_ASSIGNED_USER_ASSIGNED": "SYSTEM_ASSIGNED_USER_ASSIGNED", + "USER_ASSIGNED": "USER_ASSIGNED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "Resource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "SharedTypeKind": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "SystemData": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "created_by": { + "default": "none", + "param_type": "keyword_only" + }, + "created_by_type": { + "default": "none", + "param_type": "keyword_only" + }, + "created_at": { + "default": "none", + "param_type": "keyword_only" + }, + "last_modified_by": { + "default": "none", + "param_type": "keyword_only" + }, + "last_modified_by_type": { + "default": "none", + "param_type": "keyword_only" + }, + "last_modified_at": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "created_by": { + "attr_type": "created_by" + }, + "created_by_type": { + "attr_type": "created_by_type" + }, + "created_at": { + "attr_type": "created_at" + }, + "last_modified_by": { + "attr_type": "last_modified_by" + }, + "last_modified_by_type": { + "attr_type": "last_modified_by_type" + }, + "last_modified_at": { + "attr_type": "last_modified_at" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "TrackedResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": { + "attr_type": "tags" + }, + "location": { + "attr_type": "location" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "UserAssignedIdentity": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "principal_id": { + "attr_type": null + }, + "client_id": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "Workbook": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "identity": { + "default": "none", + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "etag": { + "default": "none", + "param_type": "keyword_only" + }, + "display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "serialized_data": { + "default": "none", + "param_type": "keyword_only" + }, + "version": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "tags_properties_tags": { + "default": "none", + "param_type": "keyword_only" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "storage_uri": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "system_data": { + "attr_type": null + }, + "display_name": { + "attr_type": "display_name" + }, + "serialized_data": { + "attr_type": "serialized_data" + }, + "version": { + "attr_type": "version" + }, + "time_modified": { + "attr_type": null + }, + "category": { + "attr_type": "category" + }, + "tags_properties_tags": { + "attr_type": "tags_properties_tags" + }, + "user_id": { + "attr_type": null + }, + "source_id": { + "attr_type": "source_id" + }, + "storage_uri": { + "attr_type": "storage_uri" + }, + "description": { + "attr_type": "description" + }, + "revision": { + "attr_type": null + }, + "identity": { + "attr_type": "identity" + }, + "kind": { + "attr_type": "kind" + }, + "etag": { + "attr_type": "etag" + }, + "tags": { + "attr_type": "tags" + }, + "location": { + "attr_type": "location" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": { + "attr_type": "error" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookErrorDefinition": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": null + }, + "message": { + "attr_type": null + }, + "innererror": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookInnerErrorTrace": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "trace": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "identity": { + "default": "none", + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "etag": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "identity": { + "attr_type": "identity" + }, + "kind": { + "attr_type": "kind" + }, + "etag": { + "attr_type": "etag" + }, + "tags": { + "attr_type": "tags" + }, + "location": { + "attr_type": "location" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookResourceIdentity": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "type": { + "default": null, + "param_type": "keyword_only" + }, + "user_assigned_identities": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "principal_id": { + "attr_type": null + }, + "tenant_id": { + "attr_type": null + }, + "type": { + "attr_type": "type" + }, + "user_assigned_identities": { + "attr_type": "user_assigned_identities" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookUpdateParameters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "serialized_data": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "tags_properties_tags": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "revision": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "tags": { + "attr_type": "tags" + }, + "display_name": { + "attr_type": "display_name" + }, + "serialized_data": { + "attr_type": "serialized_data" + }, + "category": { + "attr_type": "category" + }, + "tags_properties_tags": { + "attr_type": "tags_properties_tags" + }, + "description": { + "attr_type": "description" + }, + "revision": { + "attr_type": "revision" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbooksListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": null + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_08_01.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "workbooks": { + "attr_type": "WorkbooksOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_08_01.aio.operations": { + "class_nodes": { + "WorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "revision_get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "revision_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "revisions_list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[WorkbookUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_06_02_preview": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "operations": { + "attr_type": "Operations" + }, + "live_token": { + "attr_type": "LiveTokenOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_06_02_preview.operations": { + "class_nodes": { + "LiveTokenOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_uri": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "Operations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_06_02_preview.models": { + "class_nodes": { + "ErrorResponseLinkedStorage": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": { + "attr_type": "error" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorResponseLinkedStorageError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": null + }, + "message": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "LiveTokenResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "live_token": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationInfo": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "provider": { + "default": "none", + "param_type": "keyword_only" + }, + "resource": { + "default": "none", + "param_type": "keyword_only" + }, + "operation": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "provider": { + "attr_type": "provider" + }, + "resource": { + "attr_type": "resource" + }, + "operation": { + "attr_type": "operation" + }, + "description": { + "attr_type": "description" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationLive": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "display": { + "default": "none", + "param_type": "keyword_only" + }, + "origin": { + "default": "none", + "param_type": "keyword_only" + }, + "properties": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "display": { + "attr_type": "display" + }, + "origin": { + "attr_type": "origin" + }, + "properties": { + "attr_type": "properties" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationsListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_06_02_preview.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "operations": { + "attr_type": "Operations" + }, + "live_token": { + "attr_type": "LiveTokenOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_06_02_preview.aio.operations": { + "class_nodes": { + "LiveTokenOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_uri": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + }, + "Operations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2019_10_17_preview": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "workbook_templates": { + "attr_type": "WorkbookTemplatesOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2019_10_17_preview.operations": { + "class_nodes": { + "WorkbookTemplatesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "WorkbookTemplate", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[WorkbookTemplateUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2019_10_17_preview.models": { + "class_nodes": { + "ErrorFieldContract": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "target": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "target": { + "attr_type": "target" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "details": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "details": { + "attr_type": "details" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplate": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "priority": { + "default": "none", + "param_type": "keyword_only" + }, + "author": { + "default": "none", + "param_type": "keyword_only" + }, + "template_data": { + "default": "none", + "param_type": "keyword_only" + }, + "galleries": { + "default": "none", + "param_type": "keyword_only" + }, + "localized": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "priority": { + "attr_type": "priority" + }, + "author": { + "attr_type": "author" + }, + "template_data": { + "attr_type": "template_data" + }, + "galleries": { + "attr_type": "galleries" + }, + "localized": { + "attr_type": "localized" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateGallery": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "type": { + "default": "none", + "param_type": "keyword_only" + }, + "order": { + "default": "none", + "param_type": "keyword_only" + }, + "resource_type": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "category": { + "attr_type": "category" + }, + "type": { + "attr_type": "type" + }, + "order": { + "attr_type": "order" + }, + "resource_type": { + "attr_type": "resource_type" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateLocalizedGallery": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "template_data": { + "default": "none", + "param_type": "keyword_only" + }, + "galleries": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "template_data": { + "attr_type": "template_data" + }, + "galleries": { + "attr_type": "galleries" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplateUpdateParameters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "priority": { + "default": "none", + "param_type": "keyword_only" + }, + "author": { + "default": "none", + "param_type": "keyword_only" + }, + "template_data": { + "default": "none", + "param_type": "keyword_only" + }, + "galleries": { + "default": "none", + "param_type": "keyword_only" + }, + "localized": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": { + "attr_type": "tags" + }, + "priority": { + "attr_type": "priority" + }, + "author": { + "attr_type": "author" + }, + "template_data": { + "attr_type": "template_data" + }, + "galleries": { + "attr_type": "galleries" + }, + "localized": { + "attr_type": "localized" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookTemplatesListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2019_10_17_preview.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "workbook_templates": { + "attr_type": "WorkbookTemplatesOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2019_10_17_preview.aio.operations": { + "class_nodes": { + "WorkbookTemplatesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "WorkbookTemplate", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[WorkbookTemplateUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_03_01_preview": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "component_linked_storage_accounts": { + "attr_type": "ComponentLinkedStorageAccountsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_03_01_preview.operations": { + "class_nodes": { + "ComponentLinkedStorageAccountsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_and_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "ComponentLinkedStorageAccounts", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "ComponentLinkedStorageAccountsPatch", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_03_01_preview.models": { + "class_nodes": { + "ComponentLinkedStorageAccounts": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_account": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "linked_storage_account": { + "attr_type": "linked_storage_account" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentLinkedStorageAccountsPatch": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_account": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "linked_storage_account": { + "attr_type": "linked_storage_account" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorResponseLinkedStorage": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": { + "attr_type": "error" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorResponseLinkedStorageError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": null + }, + "message": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ProxyResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "Resource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "StorageType": { + "type": "Enum", + "methods": {}, + "properties": { + "SERVICE_PROFILER": "SERVICE_PROFILER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_03_01_preview.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "component_linked_storage_accounts": { + "attr_type": "ComponentLinkedStorageAccountsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_03_01_preview.aio.operations": { + "class_nodes": { + "ComponentLinkedStorageAccountsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_and_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "ComponentLinkedStorageAccounts", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "ComponentLinkedStorageAccountsPatch", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2022_06_15": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "web_tests": { + "attr_type": "WebTestsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2022_06_15.operations": { + "class_nodes": { + "WebTestsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "WebTest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_component": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2022_06_15.models": { + "class_nodes": { + "HeaderField": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "header_field_name": { + "default": "none", + "param_type": "keyword_only" + }, + "header_field_value": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "header_field_name": { + "attr_type": "header_field_name" + }, + "header_field_value": { + "attr_type": "header_field_value" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "TagsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "synthetic_monitor_id": { + "default": "none", + "param_type": "keyword_only" + }, + "web_test_name": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "frequency": { + "default": "int", + "param_type": "keyword_only" + }, + "timeout": { + "default": "int", + "param_type": "keyword_only" + }, + "web_test_kind": { + "default": "none", + "param_type": "keyword_only" + }, + "retry_enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "locations": { + "default": "none", + "param_type": "keyword_only" + }, + "configuration": { + "default": "none", + "param_type": "keyword_only" + }, + "request": { + "default": "none", + "param_type": "keyword_only" + }, + "validation_rules": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "synthetic_monitor_id": { + "attr_type": "synthetic_monitor_id" + }, + "web_test_name": { + "attr_type": "web_test_name" + }, + "description": { + "attr_type": "description" + }, + "enabled": { + "attr_type": "enabled" + }, + "frequency": { + "attr_type": "frequency" + }, + "timeout": { + "attr_type": "timeout" + }, + "web_test_kind": { + "attr_type": "web_test_kind" + }, + "retry_enabled": { + "attr_type": "retry_enabled" + }, + "locations": { + "attr_type": "locations" + }, + "configuration": { + "attr_type": "configuration" + }, + "provisioning_state": { + "attr_type": null + }, + "request": { + "attr_type": "request" + }, + "validation_rules": { + "attr_type": "validation_rules" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestGeolocation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "location": { + "attr_type": "location" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestKind": { + "type": "Enum", + "methods": {}, + "properties": { + "MULTISTEP": "MULTISTEP", + "PING": "PING", + "STANDARD": "STANDARD", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "WebTestListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": null, + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestPropertiesConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "web_test": { + "attr_type": "web_test" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestPropertiesRequest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "request_url": { + "default": "none", + "param_type": "keyword_only" + }, + "headers": { + "default": "none", + "param_type": "keyword_only" + }, + "http_verb": { + "default": "none", + "param_type": "keyword_only" + }, + "request_body": { + "default": "none", + "param_type": "keyword_only" + }, + "parse_dependent_requests": { + "default": "none", + "param_type": "keyword_only" + }, + "follow_redirects": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "request_url": { + "attr_type": "request_url" + }, + "headers": { + "attr_type": "headers" + }, + "http_verb": { + "attr_type": "http_verb" + }, + "request_body": { + "attr_type": "request_body" + }, + "parse_dependent_requests": { + "attr_type": "parse_dependent_requests" + }, + "follow_redirects": { + "attr_type": "follow_redirects" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestPropertiesValidationRules": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_validation": { + "default": "none", + "param_type": "keyword_only" + }, + "ssl_check": { + "default": "none", + "param_type": "keyword_only" + }, + "ssl_cert_remaining_lifetime_check": { + "default": "none", + "param_type": "keyword_only" + }, + "expected_http_status_code": { + "default": "none", + "param_type": "keyword_only" + }, + "ignore_http_status_code": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "content_validation": { + "attr_type": "content_validation" + }, + "ssl_check": { + "attr_type": "ssl_check" + }, + "ssl_cert_remaining_lifetime_check": { + "attr_type": "ssl_cert_remaining_lifetime_check" + }, + "expected_http_status_code": { + "attr_type": "expected_http_status_code" + }, + "ignore_http_status_code": { + "attr_type": "ignore_http_status_code" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestPropertiesValidationRulesContentValidation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_match": { + "default": "none", + "param_type": "keyword_only" + }, + "ignore_case": { + "default": "none", + "param_type": "keyword_only" + }, + "pass_if_text_found": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "content_match": { + "attr_type": "content_match" + }, + "ignore_case": { + "attr_type": "ignore_case" + }, + "pass_if_text_found": { + "attr_type": "pass_if_text_found" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebtestsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2022_06_15.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "web_tests": { + "attr_type": "WebTestsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2022_06_15.aio.operations": { + "class_nodes": { + "WebTestsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "WebTest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_component": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_02_02": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "components": { + "attr_type": "ComponentsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_02_02.operations": { + "class_nodes": { + "ComponentsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "ApplicationInsightsComponent", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get_purge_status": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "purge_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "purge": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "ComponentPurgeBody", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_02_02.models": { + "class_nodes": { + "ApplicationInsightsComponent": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "etag": { + "default": "none", + "param_type": "keyword_only" + }, + "application_type": { + "default": "str", + "param_type": "keyword_only" + }, + "flow_type": { + "default": "str", + "param_type": "keyword_only" + }, + "request_source": { + "default": "str", + "param_type": "keyword_only" + }, + "hockey_app_id": { + "default": "none", + "param_type": "keyword_only" + }, + "sampling_percentage": { + "default": "none", + "param_type": "keyword_only" + }, + "retention_in_days": { + "default": "none", + "param_type": "keyword_only" + }, + "disable_ip_masking": { + "default": "none", + "param_type": "keyword_only" + }, + "immediate_purge_data_on30_days": { + "default": "none", + "param_type": "keyword_only" + }, + "workspace_resource_id": { + "default": "none", + "param_type": "keyword_only" + }, + "public_network_access_for_ingestion": { + "default": "str", + "param_type": "keyword_only" + }, + "public_network_access_for_query": { + "default": "str", + "param_type": "keyword_only" + }, + "ingestion_mode": { + "default": "str", + "param_type": "keyword_only" + }, + "disable_local_auth": { + "default": "none", + "param_type": "keyword_only" + }, + "force_customer_storage_for_profiler": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "etag": { + "attr_type": "etag" + }, + "application_id": { + "attr_type": null + }, + "app_id": { + "attr_type": null + }, + "name_properties_name": { + "attr_type": null + }, + "application_type": { + "attr_type": "application_type" + }, + "flow_type": { + "attr_type": "flow_type" + }, + "request_source": { + "attr_type": "request_source" + }, + "instrumentation_key": { + "attr_type": null + }, + "creation_date": { + "attr_type": null + }, + "tenant_id": { + "attr_type": null + }, + "hockey_app_id": { + "attr_type": "hockey_app_id" + }, + "hockey_app_token": { + "attr_type": null + }, + "provisioning_state": { + "attr_type": null + }, + "sampling_percentage": { + "attr_type": "sampling_percentage" + }, + "connection_string": { + "attr_type": null + }, + "retention_in_days": { + "attr_type": "retention_in_days" + }, + "disable_ip_masking": { + "attr_type": "disable_ip_masking" + }, + "immediate_purge_data_on30_days": { + "attr_type": "immediate_purge_data_on30_days" + }, + "workspace_resource_id": { + "attr_type": "workspace_resource_id" + }, + "la_migration_date": { + "attr_type": null + }, + "private_link_scoped_resources": { + "attr_type": null + }, + "public_network_access_for_ingestion": { + "attr_type": "public_network_access_for_ingestion" + }, + "public_network_access_for_query": { + "attr_type": "public_network_access_for_query" + }, + "ingestion_mode": { + "attr_type": "ingestion_mode" + }, + "disable_local_auth": { + "attr_type": "disable_local_auth" + }, + "force_customer_storage_for_profiler": { + "attr_type": "force_customer_storage_for_profiler" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": null, + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationType": { + "type": "Enum", + "methods": {}, + "properties": { + "OTHER": "OTHER", + "WEB": "WEB", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ComponentPurgeBody": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "table": { + "default": null, + "param_type": "keyword_only" + }, + "filters": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "table": { + "attr_type": "table" + }, + "filters": { + "attr_type": "filters" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeBodyFilters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "column": { + "default": "none", + "param_type": "keyword_only" + }, + "operator": { + "default": "none", + "param_type": "keyword_only" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "key": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "column": { + "attr_type": "column" + }, + "operator": { + "attr_type": "operator" + }, + "value": { + "attr_type": "value" + }, + "key": { + "attr_type": "key" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "operation_id": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "operation_id": { + "attr_type": "operation_id" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeStatusResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "status": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "status": { + "attr_type": "status" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorResponseComponents": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": { + "attr_type": "error" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorResponseComponentsError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": null + }, + "message": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "FlowType": { + "type": "Enum", + "methods": {}, + "properties": { + "BLUEFIELD": "BLUEFIELD", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "IngestionMode": { + "type": "Enum", + "methods": {}, + "properties": { + "APPLICATION_INSIGHTS": "APPLICATION_INSIGHTS", + "APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS": "APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS", + "LOG_ANALYTICS": "LOG_ANALYTICS", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "PrivateLinkScopedResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_id": { + "default": "none", + "param_type": "keyword_only" + }, + "scope_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "resource_id": { + "attr_type": "resource_id" + }, + "scope_id": { + "attr_type": "scope_id" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "PublicNetworkAccessType": { + "type": "Enum", + "methods": {}, + "properties": { + "DISABLED": "DISABLED", + "ENABLED": "ENABLED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "PurgeState": { + "type": "Enum", + "methods": {}, + "properties": { + "COMPLETED": "COMPLETED", + "PENDING": "PENDING", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "RequestSource": { + "type": "Enum", + "methods": {}, + "properties": { + "REST": "REST", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "TagsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_02_02.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "components": { + "attr_type": "ComponentsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2020_02_02.aio.operations": { + "class_nodes": { + "ComponentsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "ApplicationInsightsComponent", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get_purge_status": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "purge_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "purge": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "ComponentPurgeBody", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_10": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "live_token": { + "attr_type": "LiveTokenOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_10.operations": { + "class_nodes": { + "LiveTokenOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_uri": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_10.models": { + "class_nodes": { + "ErrorResponseLinkedStorage": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": { + "attr_type": "error" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorResponseLinkedStorageError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": null + }, + "message": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "LiveTokenResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "live_token": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationInfo": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "provider": { + "default": "none", + "param_type": "keyword_only" + }, + "resource": { + "default": "none", + "param_type": "keyword_only" + }, + "operation": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "provider": { + "attr_type": "provider" + }, + "resource": { + "attr_type": "resource" + }, + "operation": { + "attr_type": "operation" + }, + "description": { + "attr_type": "description" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationLive": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "is_data_action": { + "default": "none", + "param_type": "keyword_only" + }, + "display": { + "default": "none", + "param_type": "keyword_only" + }, + "origin": { + "default": "none", + "param_type": "keyword_only" + }, + "properties": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "is_data_action": { + "attr_type": "is_data_action" + }, + "display": { + "attr_type": "display" + }, + "origin": { + "attr_type": "origin" + }, + "properties": { + "attr_type": "properties" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationsListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_10.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "live_token": { + "attr_type": "LiveTokenOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2021_10.aio.operations": { + "class_nodes": { + "LiveTokenOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_uri": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2015_05_01": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "operations": { + "attr_type": "Operations" + }, + "annotations": { + "attr_type": "AnnotationsOperations" + }, + "api_keys": { + "attr_type": "APIKeysOperations" + }, + "export_configurations": { + "attr_type": "ExportConfigurationsOperations" + }, + "component_current_billing_features": { + "attr_type": "ComponentCurrentBillingFeaturesOperations" + }, + "component_quota_status": { + "attr_type": "ComponentQuotaStatusOperations" + }, + "component_feature_capabilities": { + "attr_type": "ComponentFeatureCapabilitiesOperations" + }, + "component_available_features": { + "attr_type": "ComponentAvailableFeaturesOperations" + }, + "proactive_detection_configurations": { + "attr_type": "ProactiveDetectionConfigurationsOperations" + }, + "components": { + "attr_type": "ComponentsOperations" + }, + "work_item_configurations": { + "attr_type": "WorkItemConfigurationsOperations" + }, + "favorites": { + "attr_type": "FavoritesOperations" + }, + "web_test_locations": { + "attr_type": "WebTestLocationsOperations" + }, + "web_tests": { + "attr_type": "WebTestsOperations" + }, + "analytics_items": { + "attr_type": "AnalyticsItemsOperations" + }, + "workbooks": { + "attr_type": "WorkbooksOperations" + }, + "my_workbooks": { + "attr_type": "MyWorkbooksOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2015_05_01.operations": { + "class_nodes": { + "APIKeysOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "type": "APIKeyRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "AnalyticsItemsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "type": { + "default": "str", + "param_type": "positional_or_keyword" + }, + "include_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "put": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "type": "Union[str, ItemScopePath]", + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "type": "ApplicationInsightsComponentAnalyticsItem", + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "type": "Optional[bool]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "type": "Union[str, ItemScopePath]", + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "type": "Optional[bool]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "AnnotationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "type": "Annotation", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "start": { + "default": null, + "param_type": "positional_or_keyword" + }, + "end": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentAvailableFeaturesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentCurrentBillingFeaturesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "type": "ApplicationInsightsComponentBillingFeatures", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "ComponentFeatureCapabilitiesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentQuotaStatusOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "ApplicationInsightsComponent", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get_purge_status": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "purge_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "purge": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "ComponentPurgeBody", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "ExportConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "ApplicationInsightsComponentExportRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "ApplicationInsightsComponentExportRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "FavoritesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "add": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "ApplicationInsightsComponentFavorite", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_type": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "source_type": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "ApplicationInsightsComponentFavorite", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "MyWorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "MyWorkbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "MyWorkbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "Operations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ProactiveDetectionConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "ApplicationInsightsComponentProactiveDetectionConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WebTestLocationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "WebTestsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "WebTest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_component": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WorkItemConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "WorkItemCreateConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get_default": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get_item": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_item": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "WorkItemCreateConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2015_05_01.models": { + "class_nodes": { + "APIKeyRequest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "linked_read_properties": { + "default": "none", + "param_type": "keyword_only" + }, + "linked_write_properties": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "linked_read_properties": { + "attr_type": "linked_read_properties" + }, + "linked_write_properties": { + "attr_type": "linked_write_properties" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "Annotation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_name": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "event_time": { + "default": "none", + "param_type": "keyword_only" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "properties": { + "default": "none", + "param_type": "keyword_only" + }, + "related_annotation": { + "default": "str", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "annotation_name": { + "attr_type": "annotation_name" + }, + "category": { + "attr_type": "category" + }, + "event_time": { + "attr_type": "event_time" + }, + "id": { + "attr_type": "id" + }, + "properties": { + "attr_type": "properties" + }, + "related_annotation": { + "attr_type": "related_annotation" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "AnnotationError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "innererror": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "innererror": { + "attr_type": "innererror" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "AnnotationsListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponent": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "application_type": { + "default": "str", + "param_type": "keyword_only" + }, + "flow_type": { + "default": "str", + "param_type": "keyword_only" + }, + "request_source": { + "default": "str", + "param_type": "keyword_only" + }, + "hockey_app_id": { + "default": "none", + "param_type": "keyword_only" + }, + "sampling_percentage": { + "default": "none", + "param_type": "keyword_only" + }, + "retention_in_days": { + "default": "int", + "param_type": "keyword_only" + }, + "disable_ip_masking": { + "default": "none", + "param_type": "keyword_only" + }, + "immediate_purge_data_on30_days": { + "default": "none", + "param_type": "keyword_only" + }, + "ingestion_mode": { + "default": "str", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "application_id": { + "attr_type": null + }, + "app_id": { + "attr_type": null + }, + "application_type": { + "attr_type": "application_type" + }, + "flow_type": { + "attr_type": "flow_type" + }, + "request_source": { + "attr_type": "request_source" + }, + "instrumentation_key": { + "attr_type": null + }, + "creation_date": { + "attr_type": null + }, + "tenant_id": { + "attr_type": null + }, + "hockey_app_id": { + "attr_type": "hockey_app_id" + }, + "hockey_app_token": { + "attr_type": null + }, + "provisioning_state": { + "attr_type": null + }, + "sampling_percentage": { + "attr_type": "sampling_percentage" + }, + "connection_string": { + "attr_type": null + }, + "retention_in_days": { + "attr_type": "retention_in_days" + }, + "disable_ip_masking": { + "attr_type": "disable_ip_masking" + }, + "immediate_purge_data_on30_days": { + "attr_type": "immediate_purge_data_on30_days" + }, + "private_link_scoped_resources": { + "attr_type": null + }, + "ingestion_mode": { + "attr_type": "ingestion_mode" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentAPIKey": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "created_date": { + "default": "none", + "param_type": "keyword_only" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "linked_read_properties": { + "default": "none", + "param_type": "keyword_only" + }, + "linked_write_properties": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "api_key": { + "attr_type": null + }, + "created_date": { + "attr_type": "created_date" + }, + "name": { + "attr_type": "name" + }, + "linked_read_properties": { + "attr_type": "linked_read_properties" + }, + "linked_write_properties": { + "attr_type": "linked_write_properties" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentAPIKeyListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentAnalyticsItem": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "content": { + "default": "none", + "param_type": "keyword_only" + }, + "scope": { + "default": "none", + "param_type": "keyword_only" + }, + "type": { + "default": "none", + "param_type": "keyword_only" + }, + "properties": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": "id" + }, + "name": { + "attr_type": "name" + }, + "content": { + "attr_type": "content" + }, + "version": { + "attr_type": null + }, + "scope": { + "attr_type": "scope" + }, + "type": { + "attr_type": "type" + }, + "time_created": { + "attr_type": null + }, + "time_modified": { + "attr_type": null + }, + "properties": { + "attr_type": "properties" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentAnalyticsItemProperties": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "function_alias": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "function_alias": { + "attr_type": "function_alias" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentAvailableFeatures": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "result": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentBillingFeatures": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "data_volume_cap": { + "default": "none", + "param_type": "keyword_only" + }, + "current_billing_features": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "data_volume_cap": { + "attr_type": "data_volume_cap" + }, + "current_billing_features": { + "attr_type": "current_billing_features" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentDataVolumeCap": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "cap": { + "default": "none", + "param_type": "keyword_only" + }, + "warning_threshold": { + "default": "none", + "param_type": "keyword_only" + }, + "stop_send_notification_when_hit_threshold": { + "default": "none", + "param_type": "keyword_only" + }, + "stop_send_notification_when_hit_cap": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "cap": { + "attr_type": "cap" + }, + "reset_time": { + "attr_type": null + }, + "warning_threshold": { + "attr_type": "warning_threshold" + }, + "stop_send_notification_when_hit_threshold": { + "attr_type": "stop_send_notification_when_hit_threshold" + }, + "stop_send_notification_when_hit_cap": { + "attr_type": "stop_send_notification_when_hit_cap" + }, + "max_history_cap": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentExportConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "record_types": { + "default": "none", + "param_type": "keyword_only" + }, + "notification_queue_enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "export_id": { + "attr_type": null + }, + "instrumentation_key": { + "attr_type": null + }, + "record_types": { + "attr_type": "record_types" + }, + "application_name": { + "attr_type": null + }, + "subscription_id": { + "attr_type": null + }, + "resource_group": { + "attr_type": null + }, + "destination_storage_subscription_id": { + "attr_type": null + }, + "destination_storage_location_id": { + "attr_type": null + }, + "destination_account_id": { + "attr_type": null + }, + "destination_type": { + "attr_type": null + }, + "is_user_enabled": { + "attr_type": null + }, + "last_user_update": { + "attr_type": null + }, + "notification_queue_enabled": { + "attr_type": "notification_queue_enabled" + }, + "export_status": { + "attr_type": null + }, + "last_success_time": { + "attr_type": null + }, + "last_gap_time": { + "attr_type": null + }, + "permanent_error_reason": { + "attr_type": null + }, + "storage_name": { + "attr_type": null + }, + "container_name": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentExportRequest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "record_types": { + "default": "none", + "param_type": "keyword_only" + }, + "destination_type": { + "default": "none", + "param_type": "keyword_only" + }, + "destination_address": { + "default": "none", + "param_type": "keyword_only" + }, + "is_enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "notification_queue_enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "notification_queue_uri": { + "default": "none", + "param_type": "keyword_only" + }, + "destination_storage_subscription_id": { + "default": "none", + "param_type": "keyword_only" + }, + "destination_storage_location_id": { + "default": "none", + "param_type": "keyword_only" + }, + "destination_account_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "record_types": { + "attr_type": "record_types" + }, + "destination_type": { + "attr_type": "destination_type" + }, + "destination_address": { + "attr_type": "destination_address" + }, + "is_enabled": { + "attr_type": "is_enabled" + }, + "notification_queue_enabled": { + "attr_type": "notification_queue_enabled" + }, + "notification_queue_uri": { + "attr_type": "notification_queue_uri" + }, + "destination_storage_subscription_id": { + "attr_type": "destination_storage_subscription_id" + }, + "destination_storage_location_id": { + "attr_type": "destination_storage_location_id" + }, + "destination_account_id": { + "attr_type": "destination_account_id" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentFavorite": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "config": { + "default": "none", + "param_type": "keyword_only" + }, + "version": { + "default": "none", + "param_type": "keyword_only" + }, + "favorite_type": { + "default": "none", + "param_type": "keyword_only" + }, + "source_type": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "is_generated_from_template": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "config": { + "attr_type": "config" + }, + "version": { + "attr_type": "version" + }, + "favorite_id": { + "attr_type": null + }, + "favorite_type": { + "attr_type": "favorite_type" + }, + "source_type": { + "attr_type": "source_type" + }, + "time_modified": { + "attr_type": null + }, + "tags": { + "attr_type": "tags" + }, + "category": { + "attr_type": "category" + }, + "is_generated_from_template": { + "attr_type": "is_generated_from_template" + }, + "user_id": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentFeature": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "feature_name": { + "attr_type": null + }, + "meter_id": { + "attr_type": null + }, + "meter_rate_frequency": { + "attr_type": null + }, + "resouce_id": { + "attr_type": null + }, + "is_hidden": { + "attr_type": null + }, + "capabilities": { + "attr_type": null + }, + "title": { + "attr_type": null + }, + "is_main_feature": { + "attr_type": null + }, + "supported_addon_features": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentFeatureCapabilities": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "support_export_data": { + "attr_type": null + }, + "burst_throttle_policy": { + "attr_type": null + }, + "metadata_class": { + "attr_type": null + }, + "live_stream_metrics": { + "attr_type": null + }, + "application_map": { + "attr_type": null + }, + "work_item_integration": { + "attr_type": null + }, + "power_bi_integration": { + "attr_type": null + }, + "open_schema": { + "attr_type": null + }, + "proactive_detection": { + "attr_type": null + }, + "analytics_integration": { + "attr_type": null + }, + "multiple_step_web_test": { + "attr_type": null + }, + "api_access_level": { + "attr_type": null + }, + "tracking_type": { + "attr_type": null + }, + "daily_cap": { + "attr_type": null + }, + "daily_cap_reset_time": { + "attr_type": null + }, + "throttle_rate": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentFeatureCapability": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": null + }, + "description": { + "attr_type": null + }, + "value": { + "attr_type": null + }, + "unit": { + "attr_type": null + }, + "meter_id": { + "attr_type": null + }, + "meter_rate_frequency": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": null, + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentProactiveDetectionConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "send_emails_to_subscription_owners": { + "default": "none", + "param_type": "keyword_only" + }, + "custom_emails": { + "default": "none", + "param_type": "keyword_only" + }, + "last_updated_time": { + "default": "none", + "param_type": "keyword_only" + }, + "rule_definitions": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "enabled": { + "attr_type": "enabled" + }, + "send_emails_to_subscription_owners": { + "attr_type": "send_emails_to_subscription_owners" + }, + "custom_emails": { + "attr_type": "custom_emails" + }, + "last_updated_time": { + "attr_type": "last_updated_time" + }, + "rule_definitions": { + "attr_type": "rule_definitions" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "help_url": { + "default": "none", + "param_type": "keyword_only" + }, + "is_hidden": { + "default": "none", + "param_type": "keyword_only" + }, + "is_enabled_by_default": { + "default": "none", + "param_type": "keyword_only" + }, + "is_in_preview": { + "default": "none", + "param_type": "keyword_only" + }, + "supports_email_notifications": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "display_name": { + "attr_type": "display_name" + }, + "description": { + "attr_type": "description" + }, + "help_url": { + "attr_type": "help_url" + }, + "is_hidden": { + "attr_type": "is_hidden" + }, + "is_enabled_by_default": { + "attr_type": "is_enabled_by_default" + }, + "is_in_preview": { + "attr_type": "is_in_preview" + }, + "supports_email_notifications": { + "attr_type": "supports_email_notifications" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentQuotaStatus": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "app_id": { + "attr_type": null + }, + "should_be_throttled": { + "attr_type": null + }, + "expiration_time": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsComponentWebTestLocation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "display_name": { + "attr_type": null + }, + "tag": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationInsightsWebTestLocationsListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ApplicationType": { + "type": "Enum", + "methods": {}, + "properties": { + "OTHER": "OTHER", + "WEB": "WEB", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "CategoryType": { + "type": "Enum", + "methods": {}, + "properties": { + "PERFORMANCE": "PERFORMANCE", + "RETENTION": "RETENTION", + "TSG": "TSG", + "WORKBOOK": "WORKBOOK", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ComponentPurgeBody": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "table": { + "default": null, + "param_type": "keyword_only" + }, + "filters": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "table": { + "attr_type": "table" + }, + "filters": { + "attr_type": "filters" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeBodyFilters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "column": { + "default": "none", + "param_type": "keyword_only" + }, + "operator": { + "default": "none", + "param_type": "keyword_only" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "key": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "column": { + "attr_type": "column" + }, + "operator": { + "attr_type": "operator" + }, + "value": { + "attr_type": "value" + }, + "key": { + "attr_type": "key" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "operation_id": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "operation_id": { + "attr_type": "operation_id" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentPurgeStatusResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "status": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "status": { + "attr_type": "status" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ComponentsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorFieldContract": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "target": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "target": { + "attr_type": "target" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ErrorResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "FavoriteSourceType": { + "type": "Enum", + "methods": {}, + "properties": { + "EVENTS": "EVENTS", + "FUNNEL": "FUNNEL", + "IMPACT": "IMPACT", + "NOTEBOOK": "NOTEBOOK", + "RETENTION": "RETENTION", + "SEGMENTATION": "SEGMENTATION", + "SESSIONS": "SESSIONS", + "USERFLOWS": "USERFLOWS", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "FavoriteType": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "FlowType": { + "type": "Enum", + "methods": {}, + "properties": { + "BLUEFIELD": "BLUEFIELD", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "IngestionMode": { + "type": "Enum", + "methods": {}, + "properties": { + "APPLICATION_INSIGHTS": "APPLICATION_INSIGHTS", + "APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS": "APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS", + "LOG_ANALYTICS": "LOG_ANALYTICS", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "InnerError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "diagnosticcontext": { + "default": "none", + "param_type": "keyword_only" + }, + "time": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "diagnosticcontext": { + "attr_type": "diagnosticcontext" + }, + "time": { + "attr_type": "time" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "ItemScope": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ItemScopePath": { + "type": "Enum", + "methods": {}, + "properties": { + "ANALYTICS_ITEMS": "ANALYTICS_ITEMS", + "MYANALYTICS_ITEMS": "MYANALYTICS_ITEMS", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ItemType": { + "type": "Enum", + "methods": {}, + "properties": { + "FUNCTION": "FUNCTION", + "NONE": "NONE", + "QUERY": "QUERY", + "RECENT": "RECENT", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ItemTypeParameter": { + "type": "Enum", + "methods": {}, + "properties": { + "FOLDER": "FOLDER", + "FUNCTION": "FUNCTION", + "NONE": "NONE", + "QUERY": "QUERY", + "RECENT": "RECENT", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "LinkProperties": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "target_id": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "source_id": { + "attr_type": "source_id" + }, + "target_id": { + "attr_type": "target_id" + }, + "category": { + "attr_type": "category" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "MyWorkbook": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "type": { + "default": "none", + "param_type": "keyword_only" + }, + "location": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "serialized_data": { + "default": "none", + "param_type": "keyword_only" + }, + "version": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "tags_properties_tags": { + "default": "none", + "param_type": "keyword_only" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "display_name": { + "attr_type": "display_name" + }, + "serialized_data": { + "attr_type": "serialized_data" + }, + "version": { + "attr_type": "version" + }, + "time_modified": { + "attr_type": null + }, + "category": { + "attr_type": "category" + }, + "tags_properties_tags": { + "attr_type": "tags_properties_tags" + }, + "user_id": { + "attr_type": null + }, + "source_id": { + "attr_type": "source_id" + }, + "id": { + "attr_type": "id" + }, + "name": { + "attr_type": "name" + }, + "type": { + "attr_type": "type" + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "MyWorkbookError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "details": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "details": { + "attr_type": "details" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "MyWorkbookResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "type": { + "default": "none", + "param_type": "keyword_only" + }, + "location": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": "id" + }, + "name": { + "attr_type": "name" + }, + "type": { + "attr_type": "type" + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "MyWorkbooksListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "Operation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "display": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": { + "attr_type": "name" + }, + "display": { + "attr_type": "display" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationDisplay": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "provider": { + "default": "none", + "param_type": "keyword_only" + }, + "resource": { + "default": "none", + "param_type": "keyword_only" + }, + "operation": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "provider": { + "attr_type": "provider" + }, + "resource": { + "attr_type": "resource" + }, + "operation": { + "attr_type": "operation" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "OperationListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": "none", + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "PrivateLinkScopedResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_id": { + "default": "none", + "param_type": "keyword_only" + }, + "scope_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "resource_id": { + "attr_type": "resource_id" + }, + "scope_id": { + "attr_type": "scope_id" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "PurgeState": { + "type": "Enum", + "methods": {}, + "properties": { + "COMPLETED": "COMPLETED", + "PENDING": "PENDING", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "RequestSource": { + "type": "Enum", + "methods": {}, + "properties": { + "REST": "REST", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "SharedTypeKind": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "TagsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "synthetic_monitor_id": { + "default": "none", + "param_type": "keyword_only" + }, + "web_test_name": { + "default": "none", + "param_type": "keyword_only" + }, + "description": { + "default": "none", + "param_type": "keyword_only" + }, + "enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "frequency": { + "default": "int", + "param_type": "keyword_only" + }, + "timeout": { + "default": "int", + "param_type": "keyword_only" + }, + "web_test_kind": { + "default": "none", + "param_type": "keyword_only" + }, + "retry_enabled": { + "default": "none", + "param_type": "keyword_only" + }, + "locations": { + "default": "none", + "param_type": "keyword_only" + }, + "configuration": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "synthetic_monitor_id": { + "attr_type": "synthetic_monitor_id" + }, + "web_test_name": { + "attr_type": "web_test_name" + }, + "description": { + "attr_type": "description" + }, + "enabled": { + "attr_type": "enabled" + }, + "frequency": { + "attr_type": "frequency" + }, + "timeout": { + "attr_type": "timeout" + }, + "web_test_kind": { + "attr_type": "web_test_kind" + }, + "retry_enabled": { + "attr_type": "retry_enabled" + }, + "locations": { + "attr_type": "locations" + }, + "configuration": { + "attr_type": "configuration" + }, + "provisioning_state": { + "attr_type": null + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestGeolocation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "location": { + "attr_type": "location" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestKind": { + "type": "Enum", + "methods": {}, + "properties": { + "MULTISTEP": "MULTISTEP", + "PING": "PING", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "WebTestListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "value": { + "default": null, + "param_type": "keyword_only" + }, + "next_link": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": "value" + }, + "next_link": { + "attr_type": "next_link" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebTestPropertiesConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "web_test": { + "attr_type": "web_test" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WebtestsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkItemConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "connector_id": { + "default": "none", + "param_type": "keyword_only" + }, + "config_display_name": { + "default": "none", + "param_type": "keyword_only" + }, + "is_default": { + "default": "none", + "param_type": "keyword_only" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "config_properties": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "connector_id": { + "attr_type": "connector_id" + }, + "config_display_name": { + "attr_type": "config_display_name" + }, + "is_default": { + "attr_type": "is_default" + }, + "id": { + "attr_type": "id" + }, + "config_properties": { + "attr_type": "config_properties" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkItemConfigurationError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "innererror": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "innererror": { + "attr_type": "innererror" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkItemConfigurationsListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkItemCreateConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "connector_id": { + "default": "none", + "param_type": "keyword_only" + }, + "connector_data_configuration": { + "default": "none", + "param_type": "keyword_only" + }, + "validate_only": { + "default": "none", + "param_type": "keyword_only" + }, + "work_item_properties": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "connector_id": { + "attr_type": "connector_id" + }, + "connector_data_configuration": { + "attr_type": "connector_data_configuration" + }, + "validate_only": { + "attr_type": "validate_only" + }, + "work_item_properties": { + "attr_type": "work_item_properties" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "Workbook": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kind": { + "default": "none", + "param_type": "keyword_only" + }, + "name_properties_name": { + "default": "none", + "param_type": "keyword_only" + }, + "serialized_data": { + "default": "none", + "param_type": "keyword_only" + }, + "version": { + "default": "none", + "param_type": "keyword_only" + }, + "workbook_id": { + "default": "none", + "param_type": "keyword_only" + }, + "shared_type_kind": { + "default": "none", + "param_type": "keyword_only" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "tags_properties_tags": { + "default": "none", + "param_type": "keyword_only" + }, + "user_id": { + "default": "none", + "param_type": "keyword_only" + }, + "source_resource_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": { + "attr_type": "kind" + }, + "name_properties_name": { + "attr_type": "name_properties_name" + }, + "serialized_data": { + "attr_type": "serialized_data" + }, + "version": { + "attr_type": "version" + }, + "workbook_id": { + "attr_type": "workbook_id" + }, + "shared_type_kind": { + "attr_type": "shared_type_kind" + }, + "time_modified": { + "attr_type": null + }, + "category": { + "attr_type": "category" + }, + "tags_properties_tags": { + "attr_type": "tags_properties_tags" + }, + "user_id": { + "attr_type": "user_id" + }, + "source_resource_id": { + "attr_type": "source_resource_id" + }, + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "default": "none", + "param_type": "keyword_only" + }, + "message": { + "default": "none", + "param_type": "keyword_only" + }, + "details": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": { + "attr_type": "code" + }, + "message": { + "attr_type": "message" + }, + "details": { + "attr_type": "details" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbookResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": { + "attr_type": null + }, + "name": { + "attr_type": null + }, + "type": { + "attr_type": null + }, + "location": { + "attr_type": "location" + }, + "tags": { + "attr_type": "tags" + }, + "additional_properties": { + "attr_type": null + } + } + }, + "WorkbooksListResult": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "key_transformer": { + "default": "attribute_transformer", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "deserialize": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "enable_additional_properties_sending": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "from_dict": { + "parameters": { + "data": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_extractors": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "content_type": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "is_xml_model": { + "parameters": {}, + "is_async": false, + "overloads": [] + }, + "serialize": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "keep_readonly": { + "default": "bool", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "value": { + "attr_type": null + }, + "additional_properties": { + "attr_type": null + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2015_05_01.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "operations": { + "attr_type": "Operations" + }, + "annotations": { + "attr_type": "AnnotationsOperations" + }, + "api_keys": { + "attr_type": "APIKeysOperations" + }, + "export_configurations": { + "attr_type": "ExportConfigurationsOperations" + }, + "component_current_billing_features": { + "attr_type": "ComponentCurrentBillingFeaturesOperations" + }, + "component_quota_status": { + "attr_type": "ComponentQuotaStatusOperations" + }, + "component_feature_capabilities": { + "attr_type": "ComponentFeatureCapabilitiesOperations" + }, + "component_available_features": { + "attr_type": "ComponentAvailableFeaturesOperations" + }, + "proactive_detection_configurations": { + "attr_type": "ProactiveDetectionConfigurationsOperations" + }, + "components": { + "attr_type": "ComponentsOperations" + }, + "work_item_configurations": { + "attr_type": "WorkItemConfigurationsOperations" + }, + "favorites": { + "attr_type": "FavoritesOperations" + }, + "web_test_locations": { + "attr_type": "WebTestLocationsOperations" + }, + "web_tests": { + "attr_type": "WebTestsOperations" + }, + "analytics_items": { + "attr_type": "AnalyticsItemsOperations" + }, + "workbooks": { + "attr_type": "WorkbooksOperations" + }, + "my_workbooks": { + "attr_type": "MyWorkbooksOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.v2015_05_01.aio.operations": { + "class_nodes": { + "APIKeysOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "type": "APIKeyRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "AnalyticsItemsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "name": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "type": { + "default": "str", + "param_type": "positional_or_keyword" + }, + "include_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "put": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "type": "Union[str, ItemScopePath]", + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "type": "ApplicationInsightsComponentAnalyticsItem", + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "type": "Optional[bool]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "type": "Union[str, ItemScopePath]", + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "type": "Optional[bool]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "AnnotationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "type": "Annotation", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "start": { + "default": null, + "param_type": "positional_or_keyword" + }, + "end": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentAvailableFeaturesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentCurrentBillingFeaturesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "type": "ApplicationInsightsComponentBillingFeatures", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "ComponentFeatureCapabilitiesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentQuotaStatusOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "ApplicationInsightsComponent", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get_purge_status": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "purge_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "purge": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "ComponentPurgeBody", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "ExportConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "ApplicationInsightsComponentExportRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "ApplicationInsightsComponentExportRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "FavoritesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "add": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "ApplicationInsightsComponentFavorite", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_type": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "source_type": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "ApplicationInsightsComponentFavorite", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "MyWorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "MyWorkbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "MyWorkbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "Operations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ProactiveDetectionConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "ApplicationInsightsComponentProactiveDetectionConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WebTestLocationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "WebTestsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "WebTest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_component": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WorkItemConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "WorkItemCreateConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get_default": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get_item": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_item": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "WorkItemCreateConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + } + }, + "function_nodes": {} + } +} \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_delete.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_delete.py index 152ebf6584cf..2c7fe973ab93 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_get.py index 61d2377131ee..44a303c48076 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_list.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_list.py index 3e5f313b03a4..02dec0f683bd 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_put.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_put.py similarity index 96% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_put.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_put.py index a131c67cda10..7e70bacdb2a3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_put.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_put.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_create.py new file mode 100644 index 000000000000..99956ddf16ca --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_create.py @@ -0,0 +1,51 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python annotations_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.annotations.create( + resource_group_name="my-resource-group", + resource_name="my-component", + annotation_properties={ + "AnnotationName": "str", + "Category": "str", + "EventTime": "2020-02-20 00:00:00", + "Id": "str", + "Properties": "str", + "RelatedAnnotation": "null", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_delete.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_delete.py index c1817ea74c99..fcddd512226e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_get.py index 33e701d6d158..a704eb04b084 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_list.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_list.py index f85765bef725..b3ab47f2eab2 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_create.py similarity index 95% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_create.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_create.py index 9f9d03ddf4e5..228570d5a7b5 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_create.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_create.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_delete.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_delete.py index 70bdf2f72736..b72ca9ec2a18 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_get.py index 52c4a7779aae..8e21905ea589 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_list.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_list.py index 39a0c2b58ae7..9e3b450de400 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/available_billing_features_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/available_billing_features_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/available_billing_features_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/available_billing_features_get.py index 3e61f60af440..93bdf3647f19 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/available_billing_features_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/available_billing_features_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_create.py new file mode 100644 index 000000000000..3c3f18c2258c --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_create.py @@ -0,0 +1,69 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.create_or_update( + resource_group_name="my-resource-group", + resource_name="my-component", + insight_properties={ + "kind": "str", + "location": "str", + "AppId": "str", + "ApplicationId": "str", + "Application_Type": "web", + "ConnectionString": "str", + "CreationDate": "2020-02-20 00:00:00", + "DisableIpMasking": bool, + "Flow_Type": "Bluefield", + "HockeyAppId": "str", + "HockeyAppToken": "str", + "ImmediatePurgeDataOn30Days": bool, + "IngestionMode": "ApplicationInsights", + "InstrumentationKey": "str", + "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], + "Request_Source": "rest", + "RetentionInDays": 90, + "SamplingPercentage": 0.0, + "TenantId": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_delete.py new file mode 100644 index 000000000000..b28debc094db --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.components.delete( + resource_group_name="my-resource-group", + resource_name="my-component", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_get.py new file mode 100644 index 000000000000..c6606ce0bfc3 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.get( + resource_group_name="my-resource-group", + resource_name="my-component", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list.py new file mode 100644 index 000000000000..83b602169d11 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list_by_resource_group.py new file mode 100644 index 000000000000..f0f911682334 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list_by_resource_group.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.list_by_resource_group( + resource_group_name="my-resource-group", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge.py new file mode 100644 index 000000000000..e514b5f6f364 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge.py @@ -0,0 +1,47 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_purge.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-00000000000", + ) + + response = client.components.purge( + resource_group_name="OIAutoRest5123", + resource_name="aztest5048", + body={ + "filters": [{"column": "TimeGenerated", "operator": ">", "value": "2017-09-01T00:00:00"}], + "table": "Heartbeat", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsPurge.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge_status.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge_status.py new file mode 100644 index 000000000000..9706242b0933 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge_status.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_purge_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-00000000000", + ) + + response = client.components.get_purge_status( + resource_group_name="OIAutoRest5123", + resource_name="aztest5048", + purge_id="purge-970318e7-b859-4edb-8903-83b1b54d0b74", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsPurgeStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update.py new file mode 100644 index 000000000000..f2ec3e53775a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update.py @@ -0,0 +1,69 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.create_or_update( + resource_group_name="my-resource-group", + resource_name="my-component", + insight_properties={ + "kind": "str", + "location": "str", + "AppId": "str", + "ApplicationId": "str", + "Application_Type": "web", + "ConnectionString": "str", + "CreationDate": "2020-02-20 00:00:00", + "DisableIpMasking": bool, + "Flow_Type": "Bluefield", + "HockeyAppId": "str", + "HockeyAppToken": "str", + "ImmediatePurgeDataOn30Days": bool, + "IngestionMode": "ApplicationInsights", + "InstrumentationKey": "str", + "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], + "Request_Source": "rest", + "RetentionInDays": 90, + "SamplingPercentage": 0.0, + "TenantId": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update_tags_only.py new file mode 100644 index 000000000000..65b5b08ce9a6 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update_tags_only.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_update_tags_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.update_tags( + resource_group_name="my-resource-group", + resource_name="my-component", + component_tags={"tags": {"str": "str"}}, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsUpdateTagsOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/current_billing_features_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/current_billing_features_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_get.py index 0402ec0de3c3..9ebbf39c421d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/current_billing_features_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_update.py new file mode 100644 index 000000000000..a8a425df9dd4 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_update.py @@ -0,0 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python current_billing_features_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.component_current_billing_features.update( + resource_group_name="my-resource-group", + resource_name="my-component", + billing_features_properties={ + "CurrentBillingFeatures": ["str"], + "DataVolumeCap": { + "Cap": 0.0, + "MaxHistoryCap": 0.0, + "ResetTime": 0, + "StopSendNotificationWhenHitCap": bool, + "StopSendNotificationWhenHitThreshold": bool, + "WarningThreshold": 0, + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/CurrentBillingFeaturesUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_delete.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_delete.py index ab83b5e5d3e8..b57ebeb1f175 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_get.py index 9ccc2cbcea2c..37d8d42e8070 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_update.py new file mode 100644 index 000000000000..9c3b702a4a25 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_update.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python export_configuration_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.export_configurations.update( + resource_group_name="my-resource-group", + resource_name="my-component", + export_id="uGOoki0jQsyEs3IdQ83Q4QsNr4=", + export_properties={ + "DestinationAccountId": "str", + "DestinationAddress": "str", + "DestinationStorageLocationId": "str", + "DestinationStorageSubscriptionId": "str", + "DestinationType": "str", + "IsEnabled": "str", + "NotificationQueueEnabled": "str", + "NotificationQueueUri": "str", + "RecordTypes": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configurations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_list.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configurations_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_list.py index 1e35b6fb9e4e..5a4578088cf6 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configurations_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_post.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_post.py new file mode 100644 index 000000000000..3c1ddb75166f --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_post.py @@ -0,0 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python export_configurations_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.export_configurations.create( + resource_group_name="my-resource-group", + resource_name="my-component", + export_properties={ + "DestinationAccountId": "str", + "DestinationAddress": "str", + "DestinationStorageLocationId": "str", + "DestinationStorageSubscriptionId": "str", + "DestinationType": "str", + "IsEnabled": "str", + "NotificationQueueEnabled": "str", + "NotificationQueueUri": "str", + "RecordTypes": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationsPost.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_add.py similarity index 98% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_add.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_add.py index 8162fda0e14e..c88a89e2f34a 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_add.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_add.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_delete.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_delete.py index 564415ddbdd4..057e5d15bd9d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_get.py index 69b8ce3af011..de0fd0553d4f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_update.py similarity index 98% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_update.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_update.py index 491f0d8fb6bf..4f358f36d4cb 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_update.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_update.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorites_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorites_list.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorites_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorites_list.py index d1650dca6546..64e5f4e92e29 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorites_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorites_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/feature_capabilities_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/feature_capabilities_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/feature_capabilities_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/feature_capabilities_get.py index e83209ae132d..ded7e1adfd2b 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/feature_capabilities_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/feature_capabilities_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_add.py new file mode 100644 index 000000000000..01acbdaa0cc9 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_add.py @@ -0,0 +1,56 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbook_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-00000000", + ) + + response = client.my_workbooks.create_or_update( + resource_group_name="my-resource-group", + resource_name="deadb33f-8bee-4d3b-a059-9be8dac93960", + workbook_properties={ + "id": "c0deea5e-3344-40f2-96f8-6f8e1c3b5722", + "kind": "user", + "location": "west us", + "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", + "properties": { + "category": "workbook", + "displayName": "Blah Blah Blah", + "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', + "sourceId": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens", + }, + "tags": ["TagSample01", "TagSample02"], + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookAdd.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_delete.py new file mode 100644 index 000000000000..11f3afd04df4 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbook_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.my_workbooks.delete( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_get.py new file mode 100644 index 000000000000..690a4333d76a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbook_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.my_workbooks.get( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_update.py new file mode 100644 index 000000000000..f5f07bb14eba --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_update.py @@ -0,0 +1,56 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbook_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.my_workbooks.update( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + workbook_properties={ + "kind": "user", + "location": "west us", + "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", + "properties": { + "category": "workbook", + "displayName": "Blah Blah Blah", + "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', + "sourceId": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens", + "version": "ME", + }, + "tags": ["TagSample01", "TagSample02"], + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbooks_list.py new file mode 100644 index 000000000000..e3c544ff77f8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbooks_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbooks_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.my_workbooks.list_by_resource_group( + resource_group_name="my-resource-group", + category="workbook", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbooksList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configuration_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configuration_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_get.py index 6d6ecd5a03c9..a5cc51a26c19 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configuration_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_update.py new file mode 100644 index 000000000000..220d0d11869e --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_update.py @@ -0,0 +1,61 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python proactive_detection_configuration_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.proactive_detection_configurations.update( + resource_group_name="my-resource-group", + resource_name="my-component", + configuration_id="slowpageloadtime", + proactive_detection_properties={ + "CustomEmails": ["str"], + "Enabled": bool, + "LastUpdatedTime": "str", + "Name": "str", + "RuleDefinitions": { + "Description": "str", + "DisplayName": "str", + "HelpUrl": "str", + "IsEnabledByDefault": bool, + "IsHidden": bool, + "IsInPreview": bool, + "Name": "str", + "SupportsEmailNotifications": bool, + }, + "SendEmailsToSubscriptionOwners": bool, + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configurations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configurations_list.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configurations_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configurations_list.py index 8c1932d3beb1..621eac29bef8 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configurations_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configurations_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/quota_status_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/quota_status_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/quota_status_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/quota_status_get.py index 6d60fe08d8a8..2913421a91a3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/quota_status_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/quota_status_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_create.py new file mode 100644 index 000000000000..fe97e2cb6e16 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_create.py @@ -0,0 +1,62 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.create_or_update( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_definition={ + "location": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 300, + "Kind": "str", + "Locations": [{"Id": "str"}], + "Name": "str", + "RetryEnabled": bool, + "SyntheticMonitorId": "str", + "Timeout": 30, + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_delete.py new file mode 100644 index 000000000000..774210ea4f82 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.web_tests.delete( + resource_group_name="my-resource-group", + web_test_name="my-webtest-01-mywebservice", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_get.py new file mode 100644 index 000000000000..bba0ab20d94b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.get( + resource_group_name="my-resource-group", + web_test_name="my-webtest-01-mywebservice", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list.py new file mode 100644 index 000000000000..aaa360bb1ed6 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_component.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_component.py new file mode 100644 index 000000000000..96b27db95238 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_component.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_list_by_component.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.list_by_component( + component_name="my-component", + resource_group_name="my-resource-group", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestListByComponent.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_resource_group.py new file mode 100644 index 000000000000..024b45894859 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_resource_group.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.list_by_resource_group( + resource_group_name="my-resource-group", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_locations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_locations_list.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_locations_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_locations_list.py index 1ce7c1243190..b4ca721b3a13 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_locations_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_locations_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update.py new file mode 100644 index 000000000000..2370d30c2c8d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update.py @@ -0,0 +1,62 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.create_or_update( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_definition={ + "location": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 300, + "Kind": "str", + "Locations": [{"Id": "str"}], + "Name": "str", + "RetryEnabled": bool, + "SyntheticMonitorId": "str", + "Timeout": 30, + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update_tags_only.py new file mode 100644 index 000000000000..53b57e1d1434 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update_tags_only.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_update_tags_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.update_tags( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_tags={"tags": {"str": "str"}}, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestUpdateTagsOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_create.py new file mode 100644 index 000000000000..6f5998b7a8d4 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_create.py @@ -0,0 +1,49 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python work_item_config_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.work_item_configurations.create( + resource_group_name="my-resource-group", + resource_name="my-component", + work_item_configuration_properties={ + "ConnectorDataConfiguration": "str", + "ConnectorId": "str", + "ValidateOnly": bool, + "WorkItemProperties": {"str": "str"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_default_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_default_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_default_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_default_get.py index 431f85ace009..c25b36e6e383 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_default_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_default_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_delete.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_delete.py index d0224259bc69..ad520caaeeba 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_get.py index 2e475c849b9e..b90af2026cdb 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_update.py new file mode 100644 index 000000000000..491bd6873831 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_update.py @@ -0,0 +1,50 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python work_item_config_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.work_item_configurations.update_item( + resource_group_name="my-resource-group", + resource_name="my-component", + work_item_config_id="Visual Studio Team Services", + work_item_configuration_properties={ + "ConnectorDataConfiguration": "str", + "ConnectorId": "str", + "ValidateOnly": bool, + "WorkItemProperties": {"str": "str"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_configs_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_configs_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_configs_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_configs_get.py index 2e00c426c2b9..15e84f5dcebb 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_configs_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_configs_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_add.py new file mode 100644 index 000000000000..3f0179ed0744 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_add.py @@ -0,0 +1,59 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.workbooks.create_or_update( + resource_group_name="my-resource-group", + resource_name="deadb33f-8bee-4d3b-a059-9be8dac93960", + workbook_properties={ + "id": "c0deea5e-3344-40f2-96f8-6f8e1c3b5722", + "location": "west us", + "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", + "properties": { + "category": "workbook", + "kind": "shared", + "name": "Blah Blah Blah", + "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens", + "timeModified": None, + "userId": "userId", + "workbookId": "deadb33f-8bee-4d3b-a059-9be8dac93960", + }, + "tags": ["TagSample01", "TagSample02"], + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookAdd.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_delete.py new file mode 100644 index 000000000000..d5d2d7c07c99 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.workbooks.delete( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_get.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_get.py index c4c0154e325c..b77c881a3ab7 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookGet.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_update.py new file mode 100644 index 000000000000..40e50ab79c80 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_update.py @@ -0,0 +1,58 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.update( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + workbook_properties={ + "location": "west us", + "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", + "properties": { + "category": "workbook", + "kind": "shared", + "name": "Blah Blah Blah", + "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', + "timeModified": None, + "userId": "userId", + "version": "ME", + "workbookId": "deadb33f-8bee-4d3b-a059-9be8dac93960", + }, + "tags": ["TagSample01", "TagSample02"], + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbooks_list.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbooks_list.py index 037069224820..e18639c26ab0 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbooks_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbooksList.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbooksList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_create_and_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_create_and_update.py new file mode 100644 index 000000000000..9a8f873104a6 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_create_and_update.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python current_pricing_plan_create_and_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.component_current_pricing_plan.create_and_update( + resource_group_name="my-resource-group", + resource_name="my-component", + pricing_plan_properties={ + "cap": 0.0, + "id": "str", + "maxHistoryCap": 0.0, + "name": "str", + "planType": "str", + "resetHour": 0, + "stopSendNotificationWhenHitCap": bool, + "stopSendNotificationWhenHitThreshold": bool, + "type": "str", + "warningThreshold": 0, + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/CurrentPricingPlanCreateAndUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_get.py new file mode 100644 index 000000000000..e7c37ac9fcf2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python current_pricing_plan_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.component_current_pricing_plan.get( + resource_group_name="my-resource-group", + resource_name="my-component", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/CurrentPricingPlanGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_update.py new file mode 100644 index 000000000000..add639d0711d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_update.py @@ -0,0 +1,55 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python current_pricing_plan_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.component_current_pricing_plan.update( + resource_group_name="my-resource-group", + resource_name="my-component", + pricing_plan_properties={ + "cap": 0.0, + "id": "str", + "maxHistoryCap": 0.0, + "name": "str", + "planType": "str", + "resetHour": 0, + "stopSendNotificationWhenHitCap": bool, + "stopSendNotificationWhenHitThreshold": bool, + "type": "str", + "warningThreshold": 0, + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/CurrentPricingPlanUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_list_migration_date.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_list_migration_date.py new file mode 100644 index 000000000000..f91fbd007189 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_list_migration_date.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python ea_subscription_list_migration_date.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.ea_subscription_list_migration_date.post() + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/EASubscriptionListMigrationDate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_migrate_to_new_pricing_model_post.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_migrate_to_new_pricing_model_post.py new file mode 100644 index 000000000000..8dc2a7a50d98 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_migrate_to_new_pricing_model_post.py @@ -0,0 +1,39 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python ea_subscription_migrate_to_new_pricing_model_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.ea_subscription_migrate_to_new_pricing_model.post() + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/EASubscriptionMigrateToNewPricingModelPost.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_rollback_to_legacy_pricing_model_post.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_rollback_to_legacy_pricing_model_post.py new file mode 100644 index 000000000000..be081bc47fbd --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_rollback_to_legacy_pricing_model_post.py @@ -0,0 +1,39 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python ea_subscription_rollback_to_legacy_pricing_model_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.ea_subscription_rollback_to_legacy_pricing_model.post() + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/EASubscriptionRollbackToLegacyPricingModelPost.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_create.py new file mode 100644 index 000000000000..6275735496fe --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_create.py @@ -0,0 +1,71 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.create_or_update( + resource_group_name="my-resource-group", + resource_name="my-component", + insight_properties={ + "kind": "str", + "location": "str", + "AppId": "str", + "ApplicationId": "str", + "Application_Type": "web", + "ConnectionString": "str", + "CreationDate": "2020-02-20 00:00:00", + "DisableIpMasking": bool, + "Flow_Type": "Bluefield", + "HockeyAppId": "str", + "HockeyAppToken": "str", + "ImmediatePurgeDataOn30Days": bool, + "IngestionMode": "ApplicationInsights", + "InstrumentationKey": "str", + "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], + "Request_Source": "rest", + "RetentionInDays": 90, + "SamplingPercentage": 0.0, + "TenantId": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "publicNetworkAccessForIngestion": "Enabled", + "publicNetworkAccessForQuery": "Enabled", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_delete.py new file mode 100644 index 000000000000..1538b89fa797 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.components.delete( + resource_group_name="my-resource-group", + resource_name="my-component", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_get.py new file mode 100644 index 000000000000..54bac345ec1f --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.get( + resource_group_name="my-resource-group", + resource_name="my-component", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list.py new file mode 100644 index 000000000000..fccf222c07e1 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list_by_resource_group.py new file mode 100644 index 000000000000..a632f7564d80 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list_by_resource_group.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.list_by_resource_group( + resource_group_name="my-resource-group", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge.py new file mode 100644 index 000000000000..6cc63647e2ec --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge.py @@ -0,0 +1,47 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_purge.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-00000000000", + ) + + response = client.components.purge( + resource_group_name="OIAutoRest5123", + resource_name="aztest5048", + body={ + "filters": [{"column": "TimeGenerated", "operator": ">", "value": "2017-09-01T00:00:00"}], + "table": "Heartbeat", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsPurge.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge_status.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge_status.py new file mode 100644 index 000000000000..2e3c26c9dc5e --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge_status.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_purge_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-00000000000", + ) + + response = client.components.get_purge_status( + resource_group_name="OIAutoRest5123", + resource_name="aztest5048", + purge_id="purge-970318e7-b859-4edb-8903-83b1b54d0b74", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsPurgeStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update.py new file mode 100644 index 000000000000..04fd0caff9eb --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update.py @@ -0,0 +1,71 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.create_or_update( + resource_group_name="my-resource-group", + resource_name="my-component", + insight_properties={ + "kind": "str", + "location": "str", + "AppId": "str", + "ApplicationId": "str", + "Application_Type": "web", + "ConnectionString": "str", + "CreationDate": "2020-02-20 00:00:00", + "DisableIpMasking": bool, + "Flow_Type": "Bluefield", + "HockeyAppId": "str", + "HockeyAppToken": "str", + "ImmediatePurgeDataOn30Days": bool, + "IngestionMode": "ApplicationInsights", + "InstrumentationKey": "str", + "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], + "Request_Source": "rest", + "RetentionInDays": 90, + "SamplingPercentage": 0.0, + "TenantId": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "publicNetworkAccessForIngestion": "Enabled", + "publicNetworkAccessForQuery": "Enabled", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update_tags_only.py new file mode 100644 index 000000000000..a3014be3f69a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update_tags_only.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_update_tags_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.update_tags( + resource_group_name="my-resource-group", + resource_name="my-component", + component_tags={"tags": {"str": "str"}}, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsUpdateTagsOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/deleted_workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/operations_list.py similarity index 79% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/deleted_workbooks_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/operations_list.py index b470339c8222..eed76ac5cb53 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/deleted_workbooks_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/operations_list.py @@ -9,14 +9,14 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-applicationinsights # USAGE - python deleted_workbooks_list.py + python operations_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,14 +28,14 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) - response = client.deleted_workbooks.list_by_subscription() + response = client.operations.list() for item in response: print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2024-02-01-preview/examples/DeletedWorkbooksList.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_get.py new file mode 100644 index 000000000000..6d14cbd66808 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python proactive_detection_configuration_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.proactive_detection_configurations.get( + resource_group_name="my-resource-group", + resource_name="my-component", + configuration_id="slowpageloadtime", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ProactiveDetectionConfigurationGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_update.py new file mode 100644 index 000000000000..e8e9e764611d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_update.py @@ -0,0 +1,65 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python proactive_detection_configuration_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.proactive_detection_configurations.update( + resource_group_name="my-resource-group", + resource_name="my-component", + configuration_id="slowpageloadtime", + proactive_detection_properties={ + "CustomEmails": ["str"], + "Enabled": bool, + "LastUpdatedTime": "str", + "Name": "str", + "RuleDefinitions": { + "Description": "str", + "DisplayName": "str", + "HelpUrl": "str", + "IsEnabledByDefault": bool, + "IsHidden": bool, + "IsInPreview": bool, + "Name": "str", + "SupportsEmailNotifications": bool, + }, + "SendEmailsToSubscriptionOwners": bool, + "id": "str", + "location": "str", + "name": "str", + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ProactiveDetectionConfigurationUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configurations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configurations_list.py new file mode 100644 index 000000000000..8618b8bd4175 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configurations_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python proactive_detection_configurations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.proactive_detection_configurations.list( + resource_group_name="my-resource-group", + resource_name="my-component", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ProactiveDetectionConfigurationsList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create.py new file mode 100644 index 000000000000..67b8f6274413 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.create_or_update( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_definition={ + "location": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 300, + "Kind": "ping", + "Locations": [{"Id": "str"}], + "Name": "str", + "Request": { + "FollowRedirects": bool, + "Headers": [{"key": "str", "value": "str"}], + "HttpVerb": "str", + "ParseDependentRequests": bool, + "RequestBody": "str", + "RequestUrl": "str", + }, + "RetryEnabled": bool, + "SyntheticMonitorId": "str", + "Timeout": 30, + "ValidationRules": { + "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, + "ExpectedHttpStatusCode": 0, + "IgnoreHttpsStatusCode": bool, + "SSLCertRemainingLifetimeCheck": 0, + "SSLCheck": bool, + }, + "id": "str", + "kind": "ping", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_basic.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_basic.py new file mode 100644 index 000000000000..56ceea715c58 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_basic.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_create_basic.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.create_or_update( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_definition={ + "location": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 300, + "Kind": "ping", + "Locations": [{"Id": "str"}], + "Name": "str", + "Request": { + "FollowRedirects": bool, + "Headers": [{"key": "str", "value": "str"}], + "HttpVerb": "str", + "ParseDependentRequests": bool, + "RequestBody": "str", + "RequestUrl": "str", + }, + "RetryEnabled": bool, + "SyntheticMonitorId": "str", + "Timeout": 30, + "ValidationRules": { + "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, + "ExpectedHttpStatusCode": 0, + "IgnoreHttpsStatusCode": bool, + "SSLCertRemainingLifetimeCheck": 0, + "SSLCheck": bool, + }, + "id": "str", + "kind": "ping", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestCreateBasic.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_standard.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_standard.py new file mode 100644 index 000000000000..85d843cb25b7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_standard.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_create_standard.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.create_or_update( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_definition={ + "location": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 300, + "Kind": "ping", + "Locations": [{"Id": "str"}], + "Name": "str", + "Request": { + "FollowRedirects": bool, + "Headers": [{"key": "str", "value": "str"}], + "HttpVerb": "str", + "ParseDependentRequests": bool, + "RequestBody": "str", + "RequestUrl": "str", + }, + "RetryEnabled": bool, + "SyntheticMonitorId": "str", + "Timeout": 30, + "ValidationRules": { + "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, + "ExpectedHttpStatusCode": 0, + "IgnoreHttpsStatusCode": bool, + "SSLCertRemainingLifetimeCheck": 0, + "SSLCheck": bool, + }, + "id": "str", + "kind": "ping", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestCreateStandard.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_delete.py new file mode 100644 index 000000000000..91023f5c466d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.web_tests.delete( + resource_group_name="my-resource-group", + web_test_name="my-webtest-01-mywebservice", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_get.py new file mode 100644 index 000000000000..637e133d272f --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.get( + resource_group_name="my-resource-group", + web_test_name="my-webtest-01-mywebservice", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list.py new file mode 100644 index 000000000000..0de31e17e47a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_component.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_component.py new file mode 100644 index 000000000000..39dfcedd2eb2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_component.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_list_by_component.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.list_by_component( + component_name="my-component", + resource_group_name="my-resource-group", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestListByComponent.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_resource_group.py new file mode 100644 index 000000000000..eaa022c8e2a6 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_resource_group.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.list_by_resource_group( + resource_group_name="my-resource-group", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update.py new file mode 100644 index 000000000000..478560a3a8fe --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.create_or_update( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_definition={ + "location": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 300, + "Kind": "ping", + "Locations": [{"Id": "str"}], + "Name": "str", + "Request": { + "FollowRedirects": bool, + "Headers": [{"key": "str", "value": "str"}], + "HttpVerb": "str", + "ParseDependentRequests": bool, + "RequestBody": "str", + "RequestUrl": "str", + }, + "RetryEnabled": bool, + "SyntheticMonitorId": "str", + "Timeout": 30, + "ValidationRules": { + "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, + "ExpectedHttpStatusCode": 0, + "IgnoreHttpsStatusCode": bool, + "SSLCertRemainingLifetimeCheck": 0, + "SSLCheck": bool, + }, + "id": "str", + "kind": "ping", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update_tags_only.py new file mode 100644 index 000000000000..6158eb52a70a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update_tags_only.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_update_tags_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.update_tags( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_tags={"tags": {"str": "str"}}, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestUpdateTagsOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_add.py new file mode 100644 index 000000000000..1ade1948ba1f --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_add.py @@ -0,0 +1,59 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_06_17_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.workbooks.create_or_update( + resource_group_name="my-resource-group", + resource_name="deadb33f-8bee-4d3b-a059-9be8dac93960", + source_id="/subscriptions/ad2f1a83-caac-4e21-9d2a-9ca3f87105e2/resourceGroups/Default-Web-WestUS/providers/Microsoft.Web/sites/MyTestApp-CodeLens1", + workbook_properties={ + "id": "c0deea5e-3344-40f2-96f8-6f8e1c3b5722", + "kind": "shared", + "location": "west us", + "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", + "properties": { + "category": "workbook", + "displayName": "Blah Blah Blah", + "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', + "sourceId": "Azure Monitor", + "timeModified": None, + "version": "ME", + }, + "tags": None, + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-06-17-preview/examples/WorkbookAdd.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_delete.py new file mode 100644 index 000000000000..c2461c05c6ff --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_06_17_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.workbooks.delete( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-06-17-preview/examples/WorkbookDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_get.py new file mode 100644 index 000000000000..c83f4f9847d2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_06_17_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.get( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-06-17-preview/examples/WorkbookGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_update.py new file mode 100644 index 000000000000..bac5e0576c0a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_update.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_06_17_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.update( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + source_id="/subscriptions/ad2f1a83-caac-4e21-9d2a-9ca3f87105e2/resourceGroups/Default-Web-WestUS/providers/Microsoft.Web/sites/MyTestApp-CodeLens1", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-06-17-preview/examples/WorkbookUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbooks_list.py new file mode 100644 index 000000000000..3861522b7d64 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbooks_list.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2018_06_17_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbooks_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.list_by_resource_group( + resource_group_name="my-resource-group", + category="workbook", + source_id="/subscriptions/ad2f1a83-caac-4e21-9d2a-9ca3f87105e2/resourceGroups/Default-Web-WestUS/providers/Microsoft.Web/sites/MyTestApp-CodeLens1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-06-17-preview/examples/WorkbooksList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_add.py new file mode 100644 index 000000000000..0c7755696b4e --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_add.py @@ -0,0 +1,61 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2019_10_17_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_template_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.workbook_templates.create_or_update( + resource_group_name="my-resource-group", + resource_name="testtemplate2", + workbook_template_properties={ + "location": "west us", + "properties": { + "author": "Contoso", + "galleries": [ + { + "category": "Failures", + "name": "Simple Template", + "order": 100, + "resourceType": "microsoft.insights/components", + "type": "tsg", + } + ], + "priority": 1, + "templateData": {}, + }, + "tags": None, + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/WorkbookTemplateAdd.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_delete.py new file mode 100644 index 000000000000..aab359724859 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2019_10_17_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_template_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.workbook_templates.delete( + resource_group_name="my-resource-group", + resource_name="my-template-resource", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/WorkbookTemplateDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_get.py new file mode 100644 index 000000000000..6fc80f0cfc85 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2019_10_17_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_template_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbook_templates.get( + resource_group_name="my-resource-group", + resource_name="my-resource-name", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/WorkbookTemplateGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_update.py new file mode 100644 index 000000000000..5921cf9277dc --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_update.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2019_10_17_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_template_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbook_templates.update( + resource_group_name="my-resource-group", + resource_name="my-template-resource", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/WorkbookTemplateUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_templates_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_templates_list.py new file mode 100644 index 000000000000..d8efcb854908 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_templates_list.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2019_10_17_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_templates_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbook_templates.list_by_resource_group( + resource_group_name="my-resource-group", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/WorkbookTemplatesList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_create.py new file mode 100644 index 000000000000..221e75555227 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_create.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.create_or_update( + resource_group_name="my-resource-group", + resource_name="my-component", + insight_properties={ + "kind": "str", + "location": "str", + "AppId": "str", + "ApplicationId": "str", + "Application_Type": "web", + "ConnectionString": "str", + "CreationDate": "2020-02-20 00:00:00", + "DisableIpMasking": bool, + "DisableLocalAuth": bool, + "Flow_Type": "Bluefield", + "ForceCustomerStorageForProfiler": bool, + "HockeyAppId": "str", + "HockeyAppToken": "str", + "ImmediatePurgeDataOn30Days": bool, + "IngestionMode": "LogAnalytics", + "InstrumentationKey": "str", + "LaMigrationDate": "2020-02-20 00:00:00", + "Name": "str", + "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], + "Request_Source": "rest", + "RetentionInDays": 0, + "SamplingPercentage": 0.0, + "TenantId": "str", + "WorkspaceResourceId": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "publicNetworkAccessForIngestion": "Enabled", + "publicNetworkAccessForQuery": "Enabled", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_delete.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_delete.py index ec9a528b5852..a1a9acc9240f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_get.py index a3207f0c08f7..ef844f69bd43 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list.py index 26dca6ef0b92..6f55b525fc01 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list_by_resource_group.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list_by_resource_group.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list_by_resource_group.py index c2a8a27bd56d..a1bb28d669d1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list_by_resource_group.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list_by_resource_group.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge.py similarity index 95% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge.py index 43c7a6985e32..d60265095973 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge_status.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge_status.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge_status.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge_status.py index 512e8191dbd4..ca0fb0a676f3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge_status.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge_status.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update.py new file mode 100644 index 000000000000..b936dbe51d6b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.create_or_update( + resource_group_name="my-resource-group", + resource_name="my-component", + insight_properties={ + "kind": "str", + "location": "str", + "AppId": "str", + "ApplicationId": "str", + "Application_Type": "web", + "ConnectionString": "str", + "CreationDate": "2020-02-20 00:00:00", + "DisableIpMasking": bool, + "DisableLocalAuth": bool, + "Flow_Type": "Bluefield", + "ForceCustomerStorageForProfiler": bool, + "HockeyAppId": "str", + "HockeyAppToken": "str", + "ImmediatePurgeDataOn30Days": bool, + "IngestionMode": "LogAnalytics", + "InstrumentationKey": "str", + "LaMigrationDate": "2020-02-20 00:00:00", + "Name": "str", + "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], + "Request_Source": "rest", + "RetentionInDays": 0, + "SamplingPercentage": 0.0, + "TenantId": "str", + "WorkspaceResourceId": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "publicNetworkAccessForIngestion": "Enabled", + "publicNetworkAccessForQuery": "Enabled", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update_tags_only.py new file mode 100644 index 000000000000..2893c014793f --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update_tags_only.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_update_tags_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.update_tags( + resource_group_name="my-resource-group", + resource_name="my-component", + component_tags={"tags": {"str": "str"}}, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsUpdateTagsOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_create.py new file mode 100644 index 000000000000..0994a1c974b3 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_create.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.create_or_update( + resource_group_name="my-resource-group", + resource_name="my-component", + insight_properties={ + "kind": "str", + "location": "str", + "AppId": "str", + "ApplicationId": "str", + "Application_Type": "web", + "ConnectionString": "str", + "CreationDate": "2020-02-20 00:00:00", + "DisableIpMasking": bool, + "DisableLocalAuth": bool, + "Flow_Type": "Bluefield", + "ForceCustomerStorageForProfiler": bool, + "HockeyAppId": "str", + "HockeyAppToken": "str", + "ImmediatePurgeDataOn30Days": bool, + "IngestionMode": "LogAnalytics", + "InstrumentationKey": "str", + "LaMigrationDate": "2020-02-20 00:00:00", + "Name": "str", + "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], + "Request_Source": "rest", + "RetentionInDays": 0, + "SamplingPercentage": 0.0, + "TenantId": "str", + "WorkspaceResourceId": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "publicNetworkAccessForIngestion": "Enabled", + "publicNetworkAccessForQuery": "Enabled", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_delete.py new file mode 100644 index 000000000000..bd71ad9ac2cc --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.components.delete( + resource_group_name="my-resource-group", + resource_name="my-component", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_get.py new file mode 100644 index 000000000000..a965d35a3963 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.get( + resource_group_name="my-resource-group", + resource_name="my-component", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list.py new file mode 100644 index 000000000000..b4b66debb3d2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list_by_resource_group.py new file mode 100644 index 000000000000..8c662b544d63 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list_by_resource_group.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.list_by_resource_group( + resource_group_name="my-resource-group", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge.py new file mode 100644 index 000000000000..08d61a6191de --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge.py @@ -0,0 +1,47 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_purge.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-00000000000", + ) + + response = client.components.purge( + resource_group_name="OIAutoRest5123", + resource_name="aztest5048", + body={ + "filters": [{"column": "TimeGenerated", "operator": ">", "value": "2017-09-01T00:00:00"}], + "table": "Heartbeat", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsPurge.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge_status.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge_status.py new file mode 100644 index 000000000000..dc77d567382e --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge_status.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_purge_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-00000000000", + ) + + response = client.components.get_purge_status( + resource_group_name="OIAutoRest5123", + resource_name="aztest5048", + purge_id="purge-970318e7-b859-4edb-8903-83b1b54d0b74", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsPurgeStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update.py new file mode 100644 index 000000000000..93d88489db3c --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.create_or_update( + resource_group_name="my-resource-group", + resource_name="my-component", + insight_properties={ + "kind": "str", + "location": "str", + "AppId": "str", + "ApplicationId": "str", + "Application_Type": "web", + "ConnectionString": "str", + "CreationDate": "2020-02-20 00:00:00", + "DisableIpMasking": bool, + "DisableLocalAuth": bool, + "Flow_Type": "Bluefield", + "ForceCustomerStorageForProfiler": bool, + "HockeyAppId": "str", + "HockeyAppToken": "str", + "ImmediatePurgeDataOn30Days": bool, + "IngestionMode": "LogAnalytics", + "InstrumentationKey": "str", + "LaMigrationDate": "2020-02-20 00:00:00", + "Name": "str", + "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], + "Request_Source": "rest", + "RetentionInDays": 0, + "SamplingPercentage": 0.0, + "TenantId": "str", + "WorkspaceResourceId": "str", + "etag": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "publicNetworkAccessForIngestion": "Enabled", + "publicNetworkAccessForQuery": "Enabled", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update_tags_only.py new file mode 100644 index 000000000000..aa01666345bd --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update_tags_only.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_update_tags_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.components.update_tags( + resource_group_name="my-resource-group", + resource_name="my-component", + component_tags={"tags": {"str": "str"}}, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsUpdateTagsOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_create_and_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_create_and_update.py new file mode 100644 index 000000000000..bd323a646e2d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_create_and_update.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_03_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python component_linked_storage_accounts_create_and_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4918", + ) + + response = client.component_linked_storage_accounts.create_and_update( + resource_group_name="someResourceGroupName", + resource_name="myComponent", + storage_type="ServiceProfiler", + linked_storage_accounts_properties={"id": "str", "linkedStorageAccount": "str", "name": "str", "type": "str"}, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsCreateAndUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/component_linked_storage_accounts_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_delete.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/component_linked_storage_accounts_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_delete.py index 2d151402d001..09c349c0acdc 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/component_linked_storage_accounts_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_03_01_preview import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/component_linked_storage_accounts_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/component_linked_storage_accounts_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_get.py index 04333f0ec6bc..334c53501ef6 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/component_linked_storage_accounts_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_03_01_preview import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_update.py new file mode 100644 index 000000000000..fee33965b95b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_update.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_03_01_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python component_linked_storage_accounts_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4918", + ) + + response = client.component_linked_storage_accounts.update( + resource_group_name="someResourceGroupName", + resource_name="myComponent", + storage_type="ServiceProfiler", + linked_storage_accounts_properties={"linkedStorageAccount": "str"}, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/live_token_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/live_token_get.py new file mode 100644 index 000000000000..d33c1f1608b8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/live_token_get.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_06_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python live_token_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.live_token.get( + resource_uri="subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/FabrikamFiberApp/providers/microsoft.insights/components/CustomAvailabilityTest/providers/microsoft.insights/generatelivetoken", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-06-02-preview/examples/LiveTokenGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/operations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/operations_list.py new file mode 100644 index 000000000000..2e2f875235c9 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/operations_list.py @@ -0,0 +1,40 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2020_06_02_preview import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python operations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-06-02-preview/examples/Operations_List.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_add.py similarity index 97% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_add.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_add.py index afbdf5cca4dc..16e0c5cc4a6a 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_add.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_add.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_delete.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_delete.py index 292a97b7bcc7..202036ce193a 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_get.py index 956ac9946812..fcafe6ae9a53 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_update.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_update.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_update.py index c7149ae16c03..665fd729fe8b 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_template_update.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_update.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_templates_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_templates_list.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_templates_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_templates_list.py index d07f9ada07ff..cc71f0667ecb 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_templates_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_templates_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_add.py new file mode 100644 index 000000000000..b5faa52c76ad --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_add.py @@ -0,0 +1,56 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbook_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-00000000", + ) + + response = client.my_workbooks.create_or_update( + resource_group_name="my-resource-group", + resource_name="deadb33f-8bee-4d3b-a059-9be8dac93960", + workbook_properties={ + "id": "c0deea5e-3344-40f2-96f8-6f8e1c3b5722", + "kind": "user", + "location": "west us", + "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", + "properties": { + "category": "workbook", + "displayName": "Blah Blah Blah", + "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', + "sourceId": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens", + }, + "tags": ["TagSample01", "TagSample02"], + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookAdd.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_delete.py new file mode 100644 index 000000000000..3cc58a8cbd58 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbook_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + client.my_workbooks.delete( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_get.py new file mode 100644 index 000000000000..b580e7ef3023 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbook_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.my_workbooks.get( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_update.py new file mode 100644 index 000000000000..77d28ca508f5 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_update.py @@ -0,0 +1,57 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbook_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.my_workbooks.update( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + workbook_properties={ + "kind": "user", + "location": "west us", + "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", + "properties": { + "category": "workbook", + "displayName": "Blah Blah Blah", + "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', + "sourceId": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens", + "storageUri": None, + "version": "ME", + }, + "tags": ["TagSample01", "TagSample02"], + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list.py new file mode 100644 index 000000000000..b95964378693 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbooks_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.my_workbooks.list_by_resource_group( + resource_group_name="my-resource-group", + category="workbook", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbooksList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list2.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list2.py new file mode 100644 index 000000000000..9a3a431e1ffa --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list2.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python my_workbooks_list2.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.my_workbooks.list_by_resource_group( + resource_group_name="my-resource-group", + category="workbook", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbooksList2.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_add.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_add.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_add.py index 69a08b345618..50261931aad6 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_add.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_add.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -49,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookAdd.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookAdd.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_delete.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_delete.py index 9bdd1f5a6616..dfcf74cd9bf7 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookDelete.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookDelete.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get.py new file mode 100644 index 000000000000..6329a1be8512 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.get( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_get1.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get1.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_get1.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get1.py index fdf87405e7db..ddb09e3c35d3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_get1.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get1.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookGet1.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookGet1.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_managed_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_add.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_managed_add.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_add.py index f3f01b4d0055..e1e81d87f0cf 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_managed_add.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_add.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -56,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookManagedAdd.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookManagedAdd.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_managed_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_get.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_managed_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_get.py index 4cbdc43f591e..61bdb251d237 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_managed_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookManagedGet.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookManagedGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_managed_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_update.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_managed_update.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_update.py index 373bb252fb2b..56da13419c2d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_managed_update.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_update.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookManagedUpdate.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookManagedUpdate.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_revision_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revision_get.py similarity index 91% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_revision_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revision_get.py index c4cb9da1f7a5..6795952f9b4c 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_revision_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revision_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookRevisionGet.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookRevisionGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_revisions_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revisions_list.py similarity index 91% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_revisions_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revisions_list.py index 6a64e3ce6c24..31d5d3784023 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_revisions_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revisions_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookRevisionsList.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookRevisionsList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_update.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_update.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_update.py index d0318d5a4c42..dc7c74be517c 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbook_update.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_update.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbookUpdate.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookUpdate.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list.py new file mode 100644 index 000000000000..6d50230d7c3a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbooks_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.list_by_resource_group( + resource_group_name="my-resource-group", + category="workbook", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbooksList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_list2.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list2.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_list2.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list2.py index ded5c80c17c5..180b80577472 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_list2.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list2.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbooksList2.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbooksList2.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_list_sub.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list_sub.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_list_sub.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list_sub.py index c03d65521300..487e59aa62d4 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_list_sub.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list_sub.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbooksListSub.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbooksListSub.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_managed_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_managed_list.py similarity index 91% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_managed_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_managed_list.py index 0bdd28e886af..dec87f1a82d5 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/workbooks_managed_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_managed_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2023-06-01/examples/WorkbooksManagedList.json +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbooksManagedList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/live_token_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_10/live_token_get.py similarity index 93% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/live_token_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_10/live_token_get.py index e2f478173545..f9e9221bff09 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/live_token_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_10/live_token_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_10 import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +28,6 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", ) response = client.live_token.get( diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_add.py new file mode 100644 index 000000000000..788ce9628ed5 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_add.py @@ -0,0 +1,54 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.create_or_update( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + workbook_properties={ + "kind": "shared", + "location": "westus", + "properties": { + "category": "workbook", + "description": "Sample workbook", + "displayName": "Sample workbook", + "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', + }, + "tags": {"TagSample01": "sample01", "TagSample02": "sample02"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookAdd.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_delete.py new file mode 100644 index 000000000000..cb8cdbb712b7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_delete.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + client.workbooks.delete( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookDelete.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get.py new file mode 100644 index 000000000000..17c9e2e530d3 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.get( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get1.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get1.py new file mode 100644 index 000000000000..cb0683ddecee --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get1.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_get1.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.get( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookGet1.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_add.py new file mode 100644 index 000000000000..372e3605bf57 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_add.py @@ -0,0 +1,61 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_managed_add.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.create_or_update( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + workbook_properties={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myid": {} + }, + }, + "kind": "shared", + "location": "westus", + "properties": { + "category": "workbook", + "description": "Sample workbook", + "displayName": "Sample workbook", + "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":{"json":"test"},"name":"text - 0"}],"isLocked":false,"fallbackResourceIds":["/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/my-resource-group"]}', + "storageUri": "/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorage/blobServices/default/containers/mycontainer", + "version": "Notebook/1.0", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookManagedAdd.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_get.py new file mode 100644 index 000000000000..4f01843a5817 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_get.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_managed_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.get( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookManagedGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_update.py new file mode 100644 index 000000000000..08fa7f3733ab --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_update.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_managed_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.update( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookManagedUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revision_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revision_get.py new file mode 100644 index 000000000000..eae5b9b73b26 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revision_get.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_revision_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.revision_get( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + revision_id="1e2f8435b98248febee70c64ac22e1ab", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookRevisionGet.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revisions_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revisions_list.py new file mode 100644 index 000000000000..32cea41bae8f --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revisions_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_revisions_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.revisions_list( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookRevisionsList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_update.py new file mode 100644 index 000000000000..0646e502b0c7 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_update.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbook_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.update( + resource_group_name="my-resource-group", + resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list.py new file mode 100644 index 000000000000..7a9ae403ca12 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbooks_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.list_by_resource_group( + resource_group_name="my-resource-group", + category="workbook", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbooksList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list2.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list2.py new file mode 100644 index 000000000000..16ce603eee97 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list2.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbooks_list2.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.list_by_subscription( + category="workbook", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbooksList2.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list_sub.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list_sub.py new file mode 100644 index 000000000000..f2dac454326c --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list_sub.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbooks_list_sub.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", + ) + + response = client.workbooks.list_by_subscription( + category="workbook", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbooksListSub.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_managed_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_managed_list.py new file mode 100644 index 000000000000..953feb38038b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_managed_list.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python workbooks_managed_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="6b643656-33eb-422f-aee8-3ac119r124af", + ) + + response = client.workbooks.list_by_resource_group( + resource_group_name="my-resource-group", + category="workbook", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbooksManagedList.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create.py new file mode 100644 index 000000000000..74c2c867a5bf --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.create_or_update( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_definition={ + "location": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 300, + "Kind": "str", + "Locations": [{"Id": "str"}], + "Name": "str", + "Request": { + "FollowRedirects": bool, + "Headers": [{"key": "str", "value": "str"}], + "HttpVerb": "str", + "ParseDependentRequests": bool, + "RequestBody": "str", + "RequestUrl": "str", + }, + "RetryEnabled": bool, + "SyntheticMonitorId": "str", + "Timeout": 30, + "ValidationRules": { + "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, + "ExpectedHttpStatusCode": 0, + "IgnoreHttpStatusCode": bool, + "SSLCertRemainingLifetimeCheck": 0, + "SSLCheck": bool, + }, + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create_standard.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create_standard.py new file mode 100644 index 000000000000..a923b38a1ba8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create_standard.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_create_standard.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.create_or_update( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_definition={ + "location": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 300, + "Kind": "str", + "Locations": [{"Id": "str"}], + "Name": "str", + "Request": { + "FollowRedirects": bool, + "Headers": [{"key": "str", "value": "str"}], + "HttpVerb": "str", + "ParseDependentRequests": bool, + "RequestBody": "str", + "RequestUrl": "str", + }, + "RetryEnabled": bool, + "SyntheticMonitorId": "str", + "Timeout": 30, + "ValidationRules": { + "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, + "ExpectedHttpStatusCode": 0, + "IgnoreHttpStatusCode": bool, + "SSLCertRemainingLifetimeCheck": 0, + "SSLCheck": bool, + }, + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestCreateStandard.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_delete.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_delete.py index 0c3ad5115385..233839177564 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_delete.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_get.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_get.py index 02ea7d1e880b..4cf51226517e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_get.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list.py index 61a930fd74ff..c2caa44cd34e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_list_by_component.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_component.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_list_by_component.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_component.py index cc21acb32eba..73b58819c401 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_list_by_component.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_component.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_resource_group.py similarity index 94% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_list_by_resource_group.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_resource_group.py index cce63ded564a..2c4ef23c945e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_list_by_resource_group.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_resource_group.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient """ # PREREQUISITES diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update.py new file mode 100644 index 000000000000..6c2ec146872f --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update.py @@ -0,0 +1,77 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.create_or_update( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_definition={ + "location": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 300, + "Kind": "str", + "Locations": [{"Id": "str"}], + "Name": "str", + "Request": { + "FollowRedirects": bool, + "Headers": [{"key": "str", "value": "str"}], + "HttpVerb": "str", + "ParseDependentRequests": bool, + "RequestBody": "str", + "RequestUrl": "str", + }, + "RetryEnabled": bool, + "SyntheticMonitorId": "str", + "Timeout": 30, + "ValidationRules": { + "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, + "ExpectedHttpStatusCode": 0, + "IgnoreHttpStatusCode": bool, + "SSLCertRemainingLifetimeCheck": 0, + "SSLCheck": bool, + }, + "id": "str", + "kind": "str", + "name": "str", + "provisioningState": "str", + "tags": {"str": "str"}, + "type": "str", + }, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update_tags_only.py new file mode 100644 index 000000000000..e1eae593301a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update_tags_only.py @@ -0,0 +1,44 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python web_test_update_tags_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.web_tests.update_tags( + resource_group_name="my-resource-group", + web_test_name="my-webtest-my-component", + web_test_tags={"tags": {"str": "str"}}, + ) + print(response) + + +# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestUpdateTagsOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations.py index a8760d8031cd..3789c95cfd52 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations_async.py index 09e00715771f..d9b9397f2f91 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations.py index 02e112408375..7c8f8d069b43 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations_async.py index 4030a98bc228..8b8e4b082617 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations.py index 114ea6d6d495..d6b49921afae 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations_async.py index aee68fc34630..9c9777a23354 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations.py index f6e68694593f..358f8982eefd 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations_async.py index d39b647eda44..255a8c73351f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations.py index 5147ea0586b3..fa14e651937c 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations_async.py index 9bc71c9e93fd..96f58c8cb87f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations.py new file mode 100644 index 000000000000..ccb04d9e731b --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient + +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 TestApplicationInsightsManagementComponentCurrentPricingPlanOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_component_current_pricing_plan_get(self, resource_group): + response = self.client.component_current_pricing_plan.get( + resource_group_name=resource_group.name, + resource_name="str", + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_component_current_pricing_plan_create_and_update(self, resource_group): + response = self.client.component_current_pricing_plan.create_and_update( + resource_group_name=resource_group.name, + resource_name="str", + pricing_plan_properties={ + "cap": 0.0, + "id": "str", + "maxHistoryCap": 0.0, + "name": "str", + "planType": "str", + "resetHour": 0, + "stopSendNotificationWhenHitCap": bool, + "stopSendNotificationWhenHitThreshold": bool, + "type": "str", + "warningThreshold": 0, + }, + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_component_current_pricing_plan_update(self, resource_group): + response = self.client.component_current_pricing_plan.update( + resource_group_name=resource_group.name, + resource_name="str", + pricing_plan_properties={ + "cap": 0.0, + "id": "str", + "maxHistoryCap": 0.0, + "name": "str", + "planType": "str", + "resetHour": 0, + "stopSendNotificationWhenHitCap": bool, + "stopSendNotificationWhenHitThreshold": bool, + "type": "str", + "warningThreshold": 0, + }, + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations_async.py new file mode 100644 index 000000000000..6c006218232e --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations_async.py @@ -0,0 +1,80 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.applicationinsights.v2017_10_01.aio import ApplicationInsightsManagementClient + +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 TestApplicationInsightsManagementComponentCurrentPricingPlanOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_component_current_pricing_plan_get(self, resource_group): + response = await self.client.component_current_pricing_plan.get( + resource_group_name=resource_group.name, + resource_name="str", + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_component_current_pricing_plan_create_and_update(self, resource_group): + response = await self.client.component_current_pricing_plan.create_and_update( + resource_group_name=resource_group.name, + resource_name="str", + pricing_plan_properties={ + "cap": 0.0, + "id": "str", + "maxHistoryCap": 0.0, + "name": "str", + "planType": "str", + "resetHour": 0, + "stopSendNotificationWhenHitCap": bool, + "stopSendNotificationWhenHitThreshold": bool, + "type": "str", + "warningThreshold": 0, + }, + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_component_current_pricing_plan_update(self, resource_group): + response = await self.client.component_current_pricing_plan.update( + resource_group_name=resource_group.name, + resource_name="str", + pricing_plan_properties={ + "cap": 0.0, + "id": "str", + "maxHistoryCap": 0.0, + "name": "str", + "planType": "str", + "resetHour": 0, + "stopSendNotificationWhenHitCap": bool, + "stopSendNotificationWhenHitThreshold": bool, + "type": "str", + "warningThreshold": 0, + }, + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations.py index 7a3162d34d2c..8257d0d3ed78 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations_async.py index d67be9d59be0..cdb8cf0d7ede 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations.py index 9b1a2b63b668..9ec8edf8baab 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_03_01_preview import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations_async.py index 0badad5e9c96..b7b68502f93e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_03_01_preview.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations.py index a618c59889ee..de58b62c62e0 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations_async.py index bd631260d82a..290b56bca3e5 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations.py index 27767044e92d..e14ece288fcb 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations_async.py index a69397c09ca4..1c7fa192a257 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_02_02.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations.py new file mode 100644 index 000000000000..200f8b3328b4 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_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.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient + +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 TestApplicationInsightsManagementEASubscriptionListMigrationDateOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_ea_subscription_list_migration_date_post(self, resource_group): + response = self.client.ea_subscription_list_migration_date.post( + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations_async.py new file mode 100644 index 000000000000..eef360de523c --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_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.applicationinsights.v2017_10_01.aio import ApplicationInsightsManagementClient + +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 TestApplicationInsightsManagementEASubscriptionListMigrationDateOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_ea_subscription_list_migration_date_post(self, resource_group): + response = await self.client.ea_subscription_list_migration_date.post( + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations.py new file mode 100644 index 000000000000..30b13c911ea9 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_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.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient + +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 TestApplicationInsightsManagementEASubscriptionMigrateToNewPricingModelOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_ea_subscription_migrate_to_new_pricing_model_post(self, resource_group): + response = self.client.ea_subscription_migrate_to_new_pricing_model.post( + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations_async.py new file mode 100644 index 000000000000..0c9f3c89581a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_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.applicationinsights.v2017_10_01.aio import ApplicationInsightsManagementClient + +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 TestApplicationInsightsManagementEASubscriptionMigrateToNewPricingModelOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_ea_subscription_migrate_to_new_pricing_model_post(self, resource_group): + response = await self.client.ea_subscription_migrate_to_new_pricing_model.post( + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations.py new file mode 100644 index 000000000000..4593d2df0681 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_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.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient + +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 TestApplicationInsightsManagementEASubscriptionRollbackToLegacyPricingModelOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_ea_subscription_rollback_to_legacy_pricing_model_post(self, resource_group): + response = self.client.ea_subscription_rollback_to_legacy_pricing_model.post( + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations_async.py new file mode 100644 index 000000000000..45e5204fc2ce --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.applicationinsights.v2017_10_01.aio import ApplicationInsightsManagementClient + +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 TestApplicationInsightsManagementEASubscriptionRollbackToLegacyPricingModelOperationsAsync( + AzureMgmtRecordedTestCase +): + def setup_method(self, method): + self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_ea_subscription_rollback_to_legacy_pricing_model_post(self, resource_group): + response = await self.client.ea_subscription_rollback_to_legacy_pricing_model.post( + api_version="2017-10-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations.py index 46e643baddfc..f721fee6dd1d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations_async.py index aa1ab849fc70..8b2c97293086 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations.py index 23f0f1947d5f..abeed3b3b73f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations_async.py index 8d2f4aebfcd9..ca18d944c2da 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations.py index 9b7de0ad1d33..817f653fa6b3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_10 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations_async.py index d12713709676..43ccaa95396d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2021_10.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations.py new file mode 100644 index 000000000000..ea1835f8fa5c --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations.py @@ -0,0 +1,142 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient + +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 TestApplicationInsightsManagementMyWorkbooksOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_my_workbooks_list_by_resource_group(self, resource_group): + response = self.client.my_workbooks.list_by_resource_group( + resource_group_name=resource_group.name, + category="str", + api_version="2021-03-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_my_workbooks_list_by_subscription(self, resource_group): + response = self.client.my_workbooks.list_by_subscription( + category="str", + api_version="2021-03-08", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_my_workbooks_get(self, resource_group): + response = self.client.my_workbooks.get( + resource_group_name=resource_group.name, + resource_name="str", + api_version="2021-03-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_my_workbooks_delete(self, resource_group): + response = self.client.my_workbooks.delete( + resource_group_name=resource_group.name, + resource_name="str", + api_version="2021-03-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_my_workbooks_create_or_update(self, resource_group): + response = self.client.my_workbooks.create_or_update( + resource_group_name=resource_group.name, + resource_name="str", + workbook_properties={ + "category": "str", + "displayName": "str", + "etag": {"str": "str"}, + "id": "str", + "identity": {"type": "str", "userAssignedIdentities": {"principalId": "str", "tenantId": "str"}}, + "kind": "str", + "location": "str", + "name": "str", + "serializedData": "str", + "sourceId": "str", + "storageUri": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": ["str"], + "timeModified": "str", + "type": "str", + "userId": "str", + "version": "str", + }, + api_version="2021-03-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_my_workbooks_update(self, resource_group): + response = self.client.my_workbooks.update( + resource_group_name=resource_group.name, + resource_name="str", + workbook_properties={ + "category": "str", + "displayName": "str", + "etag": {"str": "str"}, + "id": "str", + "identity": {"type": "str", "userAssignedIdentities": {"principalId": "str", "tenantId": "str"}}, + "kind": "str", + "location": "str", + "name": "str", + "serializedData": "str", + "sourceId": "str", + "storageUri": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": ["str"], + "timeModified": "str", + "type": "str", + "userId": "str", + "version": "str", + }, + api_version="2021-03-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations_async.py new file mode 100644 index 000000000000..9a6ce92a6bdd --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations_async.py @@ -0,0 +1,143 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.applicationinsights.v2021_03_08.aio import ApplicationInsightsManagementClient + +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 TestApplicationInsightsManagementMyWorkbooksOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_my_workbooks_list_by_resource_group(self, resource_group): + response = self.client.my_workbooks.list_by_resource_group( + resource_group_name=resource_group.name, + category="str", + api_version="2021-03-08", + ) + 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_my_workbooks_list_by_subscription(self, resource_group): + response = self.client.my_workbooks.list_by_subscription( + category="str", + api_version="2021-03-08", + ) + 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_my_workbooks_get(self, resource_group): + response = await self.client.my_workbooks.get( + resource_group_name=resource_group.name, + resource_name="str", + api_version="2021-03-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_my_workbooks_delete(self, resource_group): + response = await self.client.my_workbooks.delete( + resource_group_name=resource_group.name, + resource_name="str", + api_version="2021-03-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_my_workbooks_create_or_update(self, resource_group): + response = await self.client.my_workbooks.create_or_update( + resource_group_name=resource_group.name, + resource_name="str", + workbook_properties={ + "category": "str", + "displayName": "str", + "etag": {"str": "str"}, + "id": "str", + "identity": {"type": "str", "userAssignedIdentities": {"principalId": "str", "tenantId": "str"}}, + "kind": "str", + "location": "str", + "name": "str", + "serializedData": "str", + "sourceId": "str", + "storageUri": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": ["str"], + "timeModified": "str", + "type": "str", + "userId": "str", + "version": "str", + }, + api_version="2021-03-08", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_my_workbooks_update(self, resource_group): + response = await self.client.my_workbooks.update( + resource_group_name=resource_group.name, + resource_name="str", + workbook_properties={ + "category": "str", + "displayName": "str", + "etag": {"str": "str"}, + "id": "str", + "identity": {"type": "str", "userAssignedIdentities": {"principalId": "str", "tenantId": "str"}}, + "kind": "str", + "location": "str", + "name": "str", + "serializedData": "str", + "sourceId": "str", + "storageUri": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": ["str"], + "timeModified": "str", + "type": "str", + "userId": "str", + "version": "str", + }, + api_version="2021-03-08", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations.py index 47448b5a430d..be4b197e11e1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_06_02_preview import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2021-03-08", + api_version="2020-06-02-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations_async.py index caae7ec45a31..2526f05107dc 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_06_02_preview.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2021-03-08", + api_version="2020-06-02-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations.py index 16a0aeaab942..57b734fdd9d6 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -24,7 +24,7 @@ def test_proactive_detection_configurations_list(self, resource_group): response = self.client.proactive_detection_configurations.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2015-05-01", + api_version="2018-05-01-preview", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_proactive_detection_configurations_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", configuration_id="str", - api_version="2015-05-01", + api_version="2018-05-01-preview", ) # please add some check logic here by yourself @@ -51,11 +51,11 @@ def test_proactive_detection_configurations_update(self, resource_group): resource_name="str", configuration_id="str", proactive_detection_properties={ - "customEmails": ["str"], - "enabled": bool, - "lastUpdatedTime": "str", - "name": "str", - "ruleDefinitions": { + "CustomEmails": ["str"], + "Enabled": bool, + "LastUpdatedTime": "str", + "Name": "str", + "RuleDefinitions": { "Description": "str", "DisplayName": "str", "HelpUrl": "str", @@ -65,9 +65,13 @@ def test_proactive_detection_configurations_update(self, resource_group): "Name": "str", "SupportsEmailNotifications": bool, }, - "sendEmailsToSubscriptionOwners": bool, + "SendEmailsToSubscriptionOwners": bool, + "id": "str", + "location": "str", + "name": "str", + "type": "str", }, - api_version="2015-05-01", + api_version="2018-05-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations_async.py index 9fae3c0ba22f..590a5b6d8908 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2018_05_01_preview.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -25,7 +25,7 @@ async def test_proactive_detection_configurations_list(self, resource_group): response = await self.client.proactive_detection_configurations.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2015-05-01", + api_version="2018-05-01-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_proactive_detection_configurations_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", configuration_id="str", - api_version="2015-05-01", + api_version="2018-05-01-preview", ) # please add some check logic here by yourself @@ -52,11 +52,11 @@ async def test_proactive_detection_configurations_update(self, resource_group): resource_name="str", configuration_id="str", proactive_detection_properties={ - "customEmails": ["str"], - "enabled": bool, - "lastUpdatedTime": "str", - "name": "str", - "ruleDefinitions": { + "CustomEmails": ["str"], + "Enabled": bool, + "LastUpdatedTime": "str", + "Name": "str", + "RuleDefinitions": { "Description": "str", "DisplayName": "str", "HelpUrl": "str", @@ -66,9 +66,13 @@ async def test_proactive_detection_configurations_update(self, resource_group): "Name": "str", "SupportsEmailNotifications": bool, }, - "sendEmailsToSubscriptionOwners": bool, + "SendEmailsToSubscriptionOwners": bool, + "id": "str", + "location": "str", + "name": "str", + "type": "str", }, - api_version="2015-05-01", + api_version="2018-05-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations.py index a8a3d72536c7..2601ee7ce413 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations_async.py index e2d73dcd34eb..cb8ed42ebd1f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations.py index b4850a5843f3..cfb105935cc5 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations_async.py index 78818f23b77f..d4c6688425b7 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2022_06_15.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations.py index f587ce75ea7a..618ed330e37c 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations_async.py index c3f6e596332c..f8ac667b06ce 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations.py index 33556f603991..2b4020d29d61 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations_async.py index 0a3967f34fd6..0e70e384fddc 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2020_11_20.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations.py index b56dddeef4b4..971d032527e8 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -23,7 +23,7 @@ def setup_method(self, method): def test_workbooks_list_by_subscription(self, resource_group): response = self.client.workbooks.list_by_subscription( category="str", - api_version="2023-06-01", + api_version="2022-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -35,7 +35,7 @@ def test_workbooks_list_by_resource_group(self, resource_group): response = self.client.workbooks.list_by_resource_group( resource_group_name=resource_group.name, category="str", - api_version="2023-06-01", + api_version="2022-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -47,7 +47,7 @@ def test_workbooks_get(self, resource_group): response = self.client.workbooks.get( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-06-01", + api_version="2022-04-01", ) # please add some check logic here by yourself @@ -59,7 +59,7 @@ def test_workbooks_delete(self, resource_group): response = self.client.workbooks.delete( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-06-01", + api_version="2022-04-01", ) # please add some check logic here by yourself @@ -104,7 +104,7 @@ def test_workbooks_create_or_update(self, resource_group): "userId": "str", "version": "str", }, - api_version="2023-06-01", + api_version="2022-04-01", ) # please add some check logic here by yourself @@ -116,7 +116,7 @@ def test_workbooks_update(self, resource_group): response = self.client.workbooks.update( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-06-01", + api_version="2022-04-01", ) # please add some check logic here by yourself @@ -128,7 +128,7 @@ def test_workbooks_revisions_list(self, resource_group): response = self.client.workbooks.revisions_list( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-06-01", + api_version="2022-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -141,7 +141,7 @@ def test_workbooks_revision_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", revision_id="str", - api_version="2023-06-01", + api_version="2022-04-01", ) # please add some check logic here by yourself diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations_async.py index ac03a8303743..033174c4aba4 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.v2022_04_01.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -24,7 +24,7 @@ def setup_method(self, method): async def test_workbooks_list_by_subscription(self, resource_group): response = self.client.workbooks.list_by_subscription( category="str", - api_version="2023-06-01", + api_version="2022-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -36,7 +36,7 @@ async def test_workbooks_list_by_resource_group(self, resource_group): response = self.client.workbooks.list_by_resource_group( resource_group_name=resource_group.name, category="str", - api_version="2023-06-01", + api_version="2022-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -48,7 +48,7 @@ async def test_workbooks_get(self, resource_group): response = await self.client.workbooks.get( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-06-01", + api_version="2022-04-01", ) # please add some check logic here by yourself @@ -60,7 +60,7 @@ async def test_workbooks_delete(self, resource_group): response = await self.client.workbooks.delete( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-06-01", + api_version="2022-04-01", ) # please add some check logic here by yourself @@ -105,7 +105,7 @@ async def test_workbooks_create_or_update(self, resource_group): "userId": "str", "version": "str", }, - api_version="2023-06-01", + api_version="2022-04-01", ) # please add some check logic here by yourself @@ -117,7 +117,7 @@ async def test_workbooks_update(self, resource_group): response = await self.client.workbooks.update( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-06-01", + api_version="2022-04-01", ) # please add some check logic here by yourself @@ -129,7 +129,7 @@ async def test_workbooks_revisions_list(self, resource_group): response = self.client.workbooks.revisions_list( resource_group_name=resource_group.name, resource_name="str", - api_version="2023-06-01", + api_version="2022-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -142,7 +142,7 @@ async def test_workbooks_revision_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", revision_id="str", - api_version="2023-06-01", + api_version="2022-04-01", ) # please add some check logic here by yourself diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/pyproject.toml b/sdk/applicationinsights/azure-mgmt-applicationinsights/pyproject.toml index 540da07d41af..228e90b1cb59 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/pyproject.toml +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/pyproject.toml @@ -1,6 +1,88 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-applicationinsights" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Applicationinsights Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">=3.9" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.applicationinsights._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-applicationinsights" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Application Insights Management" +package_doc_id = "" +is_stable = false +is_arm = true +title = "ApplicationInsightsManagementClient" +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/sdk_packaging.toml b/sdk/applicationinsights/azure-mgmt-applicationinsights/sdk_packaging.toml deleted file mode 100644 index 6058449a38ab..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/sdk_packaging.toml +++ /dev/null @@ -1,8 +0,0 @@ -[packaging] -package_name = "azure-mgmt-applicationinsights" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Application Insights Management" -package_doc_id = "" -is_stable = false -is_arm = true -title = "ApplicationInsightsManagementClient" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/setup.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/setup.py deleted file mode 100644 index 32340362cebd..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-applicationinsights" -PACKAGE_PPRINT_NAME = "Application Insights Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "typing-extensions>=4.6.0", - "azure-common>=1.1", - "azure-mgmt-core>=1.5.0", - ], - python_requires=">=3.9", -) From ba4c7df432ea76b68d44ad9cd9a3586bf53e08a0 Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 Date: Thu, 26 Mar 2026 11:44:40 +0800 Subject: [PATCH 2/3] generated from typespec:99c35678fdca0ced74272dbf4513f6220db26593 --- .../_metadata.json | 25 +- .../apiview-properties.json | 276 +- .../mgmt/applicationinsights/__init__.py | 30 + ...sights_management_client.py => _client.py} | 122 +- .../{v2020_02_02 => }/_configuration.py | 16 +- .../azure/mgmt/applicationinsights/_patch.py | 21 +- .../{v2017_10_01 => }/_utils/__init__.py | 2 +- .../applicationinsights/_utils/model_base.py | 1350 + .../{v2015_05_01 => }/_utils/serialization.py | 2 +- .../mgmt/applicationinsights/_version.py | 8 + .../{v2018_05_01_preview => }/aio/__init__.py | 4 +- .../_client.py} | 127 +- .../{v2015_05_01 => }/aio/_configuration.py | 16 +- .../{v2015_05_01 => aio}/_patch.py | 0 .../aio/operations/__init__.py | 63 + .../aio/operations/_operations.py | 8476 +++++ .../aio => aio/operations}/_patch.py | 0 .../{v2015_05_01 => }/models/__init__.py | 138 +- .../mgmt/applicationinsights/models/_enums.py | 242 + .../applicationinsights/models/_models.py | 4079 +++ .../aio/operations => models}/_patch.py | 0 .../operations/__init__.py | 63 + .../operations/_operations.py | 10559 ++++++ .../models => operations}/_patch.py | 0 .../{v2015_05_01 => }/py.typed | 0 .../v2015_05_01/__init__.py | 32 - .../v2015_05_01/_configuration.py | 75 - .../v2015_05_01/_utils/__init__.py | 6 - .../v2015_05_01/_version.py | 9 - .../v2015_05_01/aio/__init__.py | 29 - .../v2015_05_01/aio/operations/__init__.py | 57 - .../operations/_analytics_items_operations.py | 461 - .../aio/operations/_annotations_operations.py | 416 - .../aio/operations/_api_keys_operations.py | 405 - ...component_available_features_operations.py | 115 - ...ent_current_billing_features_operations.py | 253 - ...mponent_feature_capabilities_operations.py | 115 - .../_component_quota_status_operations.py | 113 - .../aio/operations/_components_operations.py | 815 - .../_export_configurations_operations.py | 545 - .../aio/operations/_favorites_operations.py | 557 - .../operations/_my_workbooks_operations.py | 653 - .../v2015_05_01/aio/operations/_operations.py | 135 - ...ive_detection_configurations_operations.py | 350 - .../_web_test_locations_operations.py | 143 - .../aio/operations/_web_tests_operations.py | 676 - .../_work_item_configurations_operations.py | 614 - .../aio/operations/_workbooks_operations.py | 555 - ...cation_insights_management_client_enums.py | 129 - .../v2015_05_01/models/_models_py3.py | 2903 -- .../v2015_05_01/operations/__init__.py | 57 - .../operations/_analytics_items_operations.py | 636 - .../operations/_annotations_operations.py | 548 - .../operations/_api_keys_operations.py | 538 - ...component_available_features_operations.py | 149 - ...ent_current_billing_features_operations.py | 323 - ...mponent_feature_capabilities_operations.py | 149 - .../_component_quota_status_operations.py | 147 - .../operations/_components_operations.py | 1061 - .../_export_configurations_operations.py | 716 - .../operations/_favorites_operations.py | 741 - .../operations/_my_workbooks_operations.py | 865 - .../v2015_05_01/operations/_operations.py | 156 - .../v2015_05_01/operations/_patch.py | 21 - ...ive_detection_configurations_operations.py | 452 - .../_web_test_locations_operations.py | 178 - .../operations/_web_tests_operations.py | 889 - .../_work_item_configurations_operations.py | 807 - .../operations/_workbooks_operations.py | 732 - .../v2017_10_01/__init__.py | 32 - ..._application_insights_management_client.py | 155 - .../v2017_10_01/_configuration.py | 75 - .../applicationinsights/v2017_10_01/_patch.py | 21 - .../v2017_10_01/_utils/serialization.py | 2041 -- .../v2017_10_01/_version.py | 9 - .../v2017_10_01/aio/__init__.py | 29 - ..._application_insights_management_client.py | 159 - .../v2017_10_01/aio/_configuration.py | 75 - .../v2017_10_01/aio/_patch.py | 21 - .../v2017_10_01/aio/operations/__init__.py | 32 - ...mponent_current_pricing_plan_operations.py | 395 - ...cription_list_migration_date_operations.py | 102 - ...migrate_to_new_pricing_model_operations.py | 98 - ...back_to_legacy_pricing_model_operations.py | 98 - .../v2017_10_01/aio/operations/_patch.py | 21 - .../v2017_10_01/models/__init__.py | 33 - .../v2017_10_01/models/_models_py3.py | 219 - .../v2017_10_01/models/_patch.py | 21 - .../v2017_10_01/operations/__init__.py | 32 - ...mponent_current_pricing_plan_operations.py | 497 - ...cription_list_migration_date_operations.py | 128 - ...migrate_to_new_pricing_model_operations.py | 126 - ...back_to_legacy_pricing_model_operations.py | 126 - .../v2017_10_01/operations/_patch.py | 21 - .../applicationinsights/v2017_10_01/py.typed | 1 - .../v2018_05_01_preview/__init__.py | 32 - ..._application_insights_management_client.py | 141 - .../v2018_05_01_preview/_configuration.py | 75 - .../v2018_05_01_preview/_patch.py | 21 - .../v2018_05_01_preview/_utils/__init__.py | 6 - .../_utils/serialization.py | 2041 -- .../v2018_05_01_preview/_version.py | 9 - ..._application_insights_management_client.py | 146 - .../v2018_05_01_preview/aio/_configuration.py | 75 - .../v2018_05_01_preview/aio/_patch.py | 21 - .../aio/operations/__init__.py | 31 - .../aio/operations/_components_operations.py | 817 - .../aio/operations/_operations.py | 133 - .../aio/operations/_patch.py | 21 - ...ive_detection_configurations_operations.py | 350 - .../aio/operations/_web_tests_operations.py | 676 - .../v2018_05_01_preview/models/__init__.py | 90 - ...cation_insights_management_client_enums.py | 76 - .../v2018_05_01_preview/models/_models_py3.py | 1302 - .../v2018_05_01_preview/models/_patch.py | 21 - .../operations/__init__.py | 31 - .../operations/_components_operations.py | 1063 - .../operations/_operations.py | 154 - .../v2018_05_01_preview/operations/_patch.py | 21 - ...ive_detection_configurations_operations.py | 452 - .../operations/_web_tests_operations.py | 889 - .../v2018_05_01_preview/py.typed | 1 - .../v2018_06_17_preview/__init__.py | 32 - ..._application_insights_management_client.py | 131 - .../v2018_06_17_preview/_configuration.py | 75 - .../v2018_06_17_preview/_patch.py | 21 - .../v2018_06_17_preview/_utils/__init__.py | 6 - .../_utils/serialization.py | 2041 -- .../v2018_06_17_preview/_version.py | 9 - .../v2018_06_17_preview/aio/__init__.py | 29 - ..._application_insights_management_client.py | 136 - .../v2018_06_17_preview/aio/_configuration.py | 75 - .../v2018_06_17_preview/aio/_patch.py | 21 - .../aio/operations/__init__.py | 27 - .../aio/operations/_operations.py | 135 - .../aio/operations/_patch.py | 21 - .../aio/operations/_workbooks_operations.py | 585 - .../v2018_06_17_preview/models/__init__.py | 52 - ...cation_insights_management_client_enums.py | 26 - .../v2018_06_17_preview/models/_models_py3.py | 484 - .../v2018_06_17_preview/models/_patch.py | 21 - .../operations/__init__.py | 27 - .../operations/_operations.py | 156 - .../v2018_06_17_preview/operations/_patch.py | 21 - .../operations/_workbooks_operations.py | 766 - .../v2018_06_17_preview/py.typed | 1 - .../v2019_10_17_preview/__init__.py | 32 - ..._application_insights_management_client.py | 130 - .../v2019_10_17_preview/_configuration.py | 75 - .../v2019_10_17_preview/_patch.py | 21 - .../v2019_10_17_preview/_utils/__init__.py | 6 - .../_utils/serialization.py | 2041 -- .../v2019_10_17_preview/_version.py | 9 - .../v2019_10_17_preview/aio/__init__.py | 29 - ..._application_insights_management_client.py | 134 - .../v2019_10_17_preview/aio/_configuration.py | 75 - .../v2019_10_17_preview/aio/_patch.py | 21 - .../aio/operations/__init__.py | 25 - .../aio/operations/_patch.py | 21 - .../_workbook_templates_operations.py | 548 - .../v2019_10_17_preview/models/__init__.py | 41 - .../v2019_10_17_preview/models/_models_py3.py | 412 - .../v2019_10_17_preview/models/_patch.py | 21 - .../operations/__init__.py | 25 - .../v2019_10_17_preview/operations/_patch.py | 21 - .../_workbook_templates_operations.py | 709 - .../v2019_10_17_preview/py.typed | 1 - .../v2020_02_02/__init__.py | 32 - ..._application_insights_management_client.py | 127 - .../applicationinsights/v2020_02_02/_patch.py | 21 - .../v2020_02_02/_utils/__init__.py | 6 - .../v2020_02_02/_utils/serialization.py | 2041 -- .../v2020_02_02/_version.py | 9 - .../v2020_02_02/aio/__init__.py | 29 - ..._application_insights_management_client.py | 132 - .../v2020_02_02/aio/_configuration.py | 75 - .../v2020_02_02/aio/_patch.py | 21 - .../v2020_02_02/aio/operations/__init__.py | 25 - .../aio/operations/_components_operations.py | 859 - .../v2020_02_02/aio/operations/_patch.py | 21 - .../v2020_02_02/models/__init__.py | 62 - ...cation_insights_management_client_enums.py | 60 - .../v2020_02_02/models/_models_py3.py | 615 - .../v2020_02_02/models/_patch.py | 21 - .../v2020_02_02/operations/__init__.py | 25 - .../operations/_components_operations.py | 1111 - .../v2020_02_02/operations/_patch.py | 21 - .../applicationinsights/v2020_02_02/py.typed | 1 - .../v2020_02_02_preview/__init__.py | 32 - ..._application_insights_management_client.py | 128 - .../v2020_02_02_preview/_configuration.py | 75 - .../v2020_02_02_preview/_patch.py | 21 - .../v2020_02_02_preview/_utils/__init__.py | 6 - .../_utils/serialization.py | 2041 -- .../v2020_02_02_preview/_version.py | 9 - .../v2020_02_02_preview/aio/__init__.py | 29 - ..._application_insights_management_client.py | 132 - .../v2020_02_02_preview/aio/_configuration.py | 75 - .../v2020_02_02_preview/aio/_patch.py | 21 - .../aio/operations/__init__.py | 25 - .../aio/operations/_components_operations.py | 849 - .../aio/operations/_patch.py | 21 - .../v2020_02_02_preview/models/__init__.py | 64 - ...cation_insights_management_client_enums.py | 60 - .../v2020_02_02_preview/models/_models_py3.py | 657 - .../v2020_02_02_preview/models/_patch.py | 21 - .../operations/__init__.py | 25 - .../operations/_components_operations.py | 1101 - .../v2020_02_02_preview/operations/_patch.py | 21 - .../v2020_02_02_preview/py.typed | 1 - .../v2020_03_01_preview/__init__.py | 32 - ..._application_insights_management_client.py | 130 - .../v2020_03_01_preview/_configuration.py | 75 - .../v2020_03_01_preview/_patch.py | 21 - .../v2020_03_01_preview/_utils/__init__.py | 6 - .../_utils/serialization.py | 2041 -- .../v2020_03_01_preview/_version.py | 9 - .../v2020_03_01_preview/aio/__init__.py | 29 - ..._application_insights_management_client.py | 134 - .../v2020_03_01_preview/aio/_configuration.py | 75 - .../v2020_03_01_preview/aio/_patch.py | 21 - .../aio/operations/__init__.py | 25 - ...nent_linked_storage_accounts_operations.py | 507 - .../aio/operations/_patch.py | 21 - .../v2020_03_01_preview/models/__init__.py | 42 - ...cation_insights_management_client_enums.py | 16 - .../v2020_03_01_preview/models/_models_py3.py | 179 - .../v2020_03_01_preview/models/_patch.py | 21 - .../operations/__init__.py | 25 - ...nent_linked_storage_accounts_operations.py | 663 - .../v2020_03_01_preview/operations/_patch.py | 21 - .../v2020_03_01_preview/py.typed | 1 - .../v2020_06_02_preview/__init__.py | 32 - ..._application_insights_management_client.py | 124 - .../v2020_06_02_preview/_configuration.py | 66 - .../v2020_06_02_preview/_patch.py | 21 - .../v2020_06_02_preview/_utils/__init__.py | 6 - .../_utils/serialization.py | 2041 -- .../v2020_06_02_preview/_version.py | 9 - .../v2020_06_02_preview/aio/__init__.py | 29 - ..._application_insights_management_client.py | 129 - .../v2020_06_02_preview/aio/_configuration.py | 66 - .../v2020_06_02_preview/aio/_patch.py | 21 - .../aio/operations/__init__.py | 27 - .../aio/operations/_live_token_operations.py | 109 - .../aio/operations/_operations.py | 134 - .../aio/operations/_patch.py | 21 - .../v2020_06_02_preview/models/__init__.py | 37 - .../v2020_06_02_preview/models/_models_py3.py | 213 - .../v2020_06_02_preview/models/_patch.py | 21 - .../operations/__init__.py | 27 - .../operations/_live_token_operations.py | 135 - .../operations/_operations.py | 154 - .../v2020_06_02_preview/operations/_patch.py | 21 - .../v2020_06_02_preview/py.typed | 1 - .../v2020_11_20/__init__.py | 32 - ..._application_insights_management_client.py | 130 - .../v2020_11_20/_configuration.py | 75 - .../applicationinsights/v2020_11_20/_patch.py | 21 - .../v2020_11_20/_utils/__init__.py | 6 - .../v2020_11_20/_utils/serialization.py | 2041 -- .../v2020_11_20/_version.py | 9 - .../v2020_11_20/aio/__init__.py | 29 - ..._application_insights_management_client.py | 134 - .../v2020_11_20/aio/_configuration.py | 75 - .../v2020_11_20/aio/_patch.py | 21 - .../v2020_11_20/aio/operations/__init__.py | 25 - .../v2020_11_20/aio/operations/_patch.py | 21 - .../_workbook_templates_operations.py | 547 - .../v2020_11_20/models/__init__.py | 43 - .../v2020_11_20/models/_models_py3.py | 430 - .../v2020_11_20/models/_patch.py | 21 - .../v2020_11_20/operations/__init__.py | 25 - .../v2020_11_20/operations/_patch.py | 21 - .../_workbook_templates_operations.py | 709 - .../applicationinsights/v2020_11_20/py.typed | 1 - .../v2021_03_08/__init__.py | 32 - ..._application_insights_management_client.py | 128 - .../v2021_03_08/_configuration.py | 75 - .../applicationinsights/v2021_03_08/_patch.py | 21 - .../v2021_03_08/_utils/__init__.py | 6 - .../v2021_03_08/_utils/serialization.py | 2041 -- .../v2021_03_08/_version.py | 9 - .../v2021_03_08/aio/__init__.py | 29 - ..._application_insights_management_client.py | 132 - .../v2021_03_08/aio/_configuration.py | 75 - .../v2021_03_08/aio/_patch.py | 21 - .../v2021_03_08/aio/operations/__init__.py | 25 - .../operations/_my_workbooks_operations.py | 683 - .../v2021_03_08/aio/operations/_patch.py | 21 - .../v2021_03_08/models/__init__.py | 54 - ...cation_insights_management_client_enums.py | 42 - .../v2021_03_08/models/_models_py3.py | 469 - .../v2021_03_08/models/_patch.py | 21 - .../v2021_03_08/operations/__init__.py | 25 - .../operations/_my_workbooks_operations.py | 912 - .../v2021_03_08/operations/_patch.py | 21 - .../applicationinsights/v2021_03_08/py.typed | 1 - .../v2021_08_01/__init__.py | 32 - ..._application_insights_management_client.py | 127 - .../v2021_08_01/_configuration.py | 75 - .../applicationinsights/v2021_08_01/_patch.py | 21 - .../v2021_08_01/_utils/__init__.py | 6 - .../v2021_08_01/_utils/serialization.py | 2041 -- .../v2021_08_01/_version.py | 9 - .../v2021_08_01/aio/__init__.py | 29 - ..._application_insights_management_client.py | 132 - .../v2021_08_01/aio/_configuration.py | 75 - .../v2021_08_01/aio/_patch.py | 21 - .../v2021_08_01/aio/operations/__init__.py | 25 - .../v2021_08_01/aio/operations/_patch.py | 21 - .../aio/operations/_workbooks_operations.py | 849 - .../v2021_08_01/models/__init__.py | 64 - ...cation_insights_management_client_enums.py | 53 - .../v2021_08_01/models/_models_py3.py | 706 - .../v2021_08_01/models/_patch.py | 21 - .../v2021_08_01/operations/__init__.py | 25 - .../v2021_08_01/operations/_patch.py | 21 - .../operations/_workbooks_operations.py | 1152 - .../applicationinsights/v2021_08_01/py.typed | 1 - .../applicationinsights/v2021_10/__init__.py | 32 - ..._application_insights_management_client.py | 120 - .../v2021_10/_configuration.py | 66 - .../applicationinsights/v2021_10/_patch.py | 21 - .../v2021_10/_utils/__init__.py | 6 - .../v2021_10/_utils/serialization.py | 2041 -- .../applicationinsights/v2021_10/_version.py | 9 - .../v2021_10/aio/__init__.py | 29 - ..._application_insights_management_client.py | 124 - .../v2021_10/aio/_configuration.py | 66 - .../v2021_10/aio/_patch.py | 21 - .../v2021_10/aio/operations/__init__.py | 25 - .../aio/operations/_live_token_operations.py | 108 - .../v2021_10/aio/operations/_patch.py | 21 - .../v2021_10/models/__init__.py | 37 - .../v2021_10/models/_models_py3.py | 218 - .../v2021_10/models/_patch.py | 21 - .../v2021_10/operations/__init__.py | 25 - .../operations/_live_token_operations.py | 134 - .../v2021_10/operations/_patch.py | 21 - .../applicationinsights/v2021_10/py.typed | 1 - .../v2022_04_01/__init__.py | 32 - ..._application_insights_management_client.py | 127 - .../v2022_04_01/_configuration.py | 75 - .../applicationinsights/v2022_04_01/_patch.py | 21 - .../v2022_04_01/_utils/__init__.py | 6 - .../v2022_04_01/_utils/serialization.py | 2041 -- .../v2022_04_01/_version.py | 9 - .../v2022_04_01/aio/__init__.py | 29 - ..._application_insights_management_client.py | 132 - .../v2022_04_01/aio/_configuration.py | 75 - .../v2022_04_01/aio/_patch.py | 21 - .../v2022_04_01/aio/operations/__init__.py | 25 - .../v2022_04_01/aio/operations/_patch.py | 21 - .../aio/operations/_workbooks_operations.py | 849 - .../v2022_04_01/models/__init__.py | 64 - ...cation_insights_management_client_enums.py | 51 - .../v2022_04_01/models/_models_py3.py | 704 - .../v2022_04_01/models/_patch.py | 21 - .../v2022_04_01/operations/__init__.py | 25 - .../v2022_04_01/operations/_patch.py | 21 - .../operations/_workbooks_operations.py | 1152 - .../applicationinsights/v2022_04_01/py.typed | 1 - .../v2022_06_15/__init__.py | 32 - ..._application_insights_management_client.py | 127 - .../v2022_06_15/_configuration.py | 75 - .../applicationinsights/v2022_06_15/_patch.py | 21 - .../v2022_06_15/_utils/__init__.py | 6 - .../v2022_06_15/_utils/serialization.py | 2041 -- .../v2022_06_15/_version.py | 9 - .../v2022_06_15/aio/__init__.py | 29 - ..._application_insights_management_client.py | 132 - .../v2022_06_15/aio/_configuration.py | 75 - .../v2022_06_15/aio/_patch.py | 21 - .../v2022_06_15/aio/operations/__init__.py | 25 - .../v2022_06_15/aio/operations/_patch.py | 21 - .../aio/operations/_web_tests_operations.py | 678 - .../v2022_06_15/models/__init__.py | 50 - ...cation_insights_management_client_enums.py | 18 - .../v2022_06_15/models/_models_py3.py | 511 - .../v2022_06_15/models/_patch.py | 21 - .../v2022_06_15/operations/__init__.py | 25 - .../v2022_06_15/operations/_patch.py | 21 - .../operations/_web_tests_operations.py | 891 - .../applicationinsights/v2022_06_15/py.typed | 1 - .../code_report_typespec.json | 28660 ++++++++++++++++ .../analytics_item_delete.py | 9 +- .../{v2015_05_01 => }/analytics_item_get.py | 9 +- .../{v2015_05_01 => }/analytics_item_list.py | 9 +- .../{v2015_05_01 => }/analytics_item_put.py | 8 +- .../{v2015_05_01 => }/annotations_create.py | 20 +- .../{v2015_05_01 => }/annotations_delete.py | 9 +- .../{v2015_05_01 => }/annotations_get.py | 9 +- .../{v2015_05_01 => }/annotations_list.py | 9 +- .../{v2015_05_01 => }/api_keys_create.py | 8 +- .../{v2015_05_01 => }/api_keys_delete.py | 9 +- .../{v2015_05_01 => }/api_keys_get.py | 9 +- .../{v2015_05_01 => }/api_keys_list.py | 9 +- .../available_billing_features_get.py | 9 +- .../generated_samples/components_create.py | 53 + .../{v2020_02_02 => }/components_delete.py | 9 +- .../{v2015_05_01 => }/components_get.py | 9 +- .../{v2020_02_02 => }/components_list.py | 9 +- .../components_list_by_resource_group.py | 9 +- .../{v2020_02_02 => }/components_purge.py | 9 +- .../components_purge_status.py | 9 +- ...icing_plan_get.py => components_update.py} | 18 +- .../components_update_tags_only.py | 19 +- .../current_billing_features_get.py | 9 +- .../current_billing_features_update.py | 46 + .../export_configuration_delete.py | 9 +- .../export_configuration_get.py | 9 +- .../export_configuration_update.py | 26 +- .../export_configurations_list.py | 9 +- .../export_configurations_post.py | 26 +- .../{v2015_05_01 => }/favorite_add.py | 10 +- .../{v2015_05_01 => }/favorite_delete.py | 9 +- .../{v2015_05_01 => }/favorite_get.py | 9 +- .../{v2015_05_01 => }/favorite_update.py | 12 +- .../{v2015_05_01 => }/favorites_list.py | 9 +- .../feature_capabilities_get.py | 9 +- .../proactive_detection_configuration_get.py | 9 +- ...roactive_detection_configuration_update.py | 36 +- ...proactive_detection_configurations_list.py | 9 +- .../{v2015_05_01 => }/quota_status_get.py | 9 +- .../v2015_05_01/components_create.py | 69 - .../v2015_05_01/components_delete.py | 42 - .../v2015_05_01/components_list.py | 41 - .../components_list_by_resource_group.py | 43 - .../v2015_05_01/components_purge.py | 47 - .../v2015_05_01/components_purge_status.py | 44 - .../v2015_05_01/components_update.py | 69 - .../current_billing_features_update.py | 54 - .../v2015_05_01/my_workbook_add.py | 56 - .../v2015_05_01/my_workbook_delete.py | 42 - .../v2015_05_01/my_workbook_get.py | 43 - .../v2015_05_01/my_workbook_update.py | 56 - .../v2015_05_01/my_workbooks_list.py | 44 - .../v2015_05_01/web_test_create.py | 62 - .../v2015_05_01/web_test_delete.py | 42 - .../v2015_05_01/web_test_get.py | 43 - .../v2015_05_01/web_test_list.py | 41 - .../v2015_05_01/web_test_list_by_component.py | 44 - .../web_test_list_by_resource_group.py | 43 - .../v2015_05_01/web_test_update.py | 62 - .../v2015_05_01/web_test_update_tags_only.py | 44 - .../v2015_05_01/workbook_add.py | 59 - .../v2015_05_01/workbook_delete.py | 42 - .../v2015_05_01/workbook_get.py | 43 - .../v2015_05_01/workbook_update.py | 58 - .../v2015_05_01/workbooks_list.py | 44 - .../current_pricing_plan_create_and_update.py | 55 - .../current_pricing_plan_update.py | 55 - .../ea_subscription_list_migration_date.py | 40 - ...ption_migrate_to_new_pricing_model_post.py | 39 - ...n_rollback_to_legacy_pricing_model_post.py | 39 - .../v2018_05_01_preview/components_create.py | 71 - .../v2018_05_01_preview/components_delete.py | 42 - .../v2018_05_01_preview/components_get.py | 43 - .../v2018_05_01_preview/components_list.py | 41 - .../components_list_by_resource_group.py | 43 - .../v2018_05_01_preview/components_purge.py | 47 - .../components_purge_status.py | 44 - .../v2018_05_01_preview/components_update.py | 71 - .../components_update_tags_only.py | 44 - .../v2018_05_01_preview/operations_list.py | 41 - .../proactive_detection_configuration_get.py | 44 - ...roactive_detection_configuration_update.py | 65 - ...proactive_detection_configurations_list.py | 43 - .../v2018_05_01_preview/web_test_create.py | 77 - .../web_test_create_basic.py | 77 - .../web_test_create_standard.py | 77 - .../v2018_05_01_preview/web_test_delete.py | 42 - .../v2018_05_01_preview/web_test_get.py | 43 - .../v2018_05_01_preview/web_test_list.py | 41 - .../web_test_list_by_component.py | 44 - .../web_test_list_by_resource_group.py | 43 - .../v2018_05_01_preview/web_test_update.py | 77 - .../web_test_update_tags_only.py | 44 - .../v2018_06_17_preview/workbook_add.py | 59 - .../v2018_06_17_preview/workbook_delete.py | 42 - .../v2018_06_17_preview/workbook_get.py | 43 - .../v2018_06_17_preview/workbook_update.py | 44 - .../v2018_06_17_preview/workbooks_list.py | 45 - .../workbook_template_add.py | 61 - .../workbook_template_delete.py | 42 - .../workbook_template_get.py | 43 - .../workbook_template_update.py | 43 - .../workbook_templates_list.py | 43 - .../v2020_02_02/components_create.py | 77 - .../v2020_02_02/components_get.py | 43 - .../v2020_02_02/components_update.py | 77 - .../components_update_tags_only.py | 44 - .../v2020_02_02_preview/components_create.py | 77 - .../v2020_02_02_preview/components_delete.py | 42 - .../v2020_02_02_preview/components_get.py | 43 - .../v2020_02_02_preview/components_list.py | 41 - .../components_list_by_resource_group.py | 43 - .../v2020_02_02_preview/components_purge.py | 47 - .../components_purge_status.py | 44 - .../v2020_02_02_preview/components_update.py | 77 - .../components_update_tags_only.py | 44 - ...nked_storage_accounts_create_and_update.py | 45 - ...omponent_linked_storage_accounts_delete.py | 43 - .../component_linked_storage_accounts_get.py | 44 - ...omponent_linked_storage_accounts_update.py | 45 - .../v2020_06_02_preview/live_token_get.py | 41 - .../v2020_06_02_preview/operations_list.py | 40 - .../v2020_11_20/workbook_template_add.py | 86 - .../v2020_11_20/workbook_template_delete.py | 42 - .../v2020_11_20/workbook_template_get.py | 43 - .../v2020_11_20/workbook_template_update.py | 43 - .../v2020_11_20/workbook_templates_list.py | 43 - .../v2021_03_08/my_workbook_add.py | 56 - .../v2021_03_08/my_workbook_delete.py | 42 - .../v2021_03_08/my_workbook_get.py | 43 - .../v2021_03_08/my_workbook_update.py | 57 - .../v2021_03_08/my_workbooks_list.py | 44 - .../v2021_03_08/my_workbooks_list2.py | 44 - .../v2021_08_01/workbook_add.py | 54 - .../v2021_08_01/workbook_delete.py | 42 - .../v2021_08_01/workbook_get.py | 43 - .../v2021_08_01/workbook_get1.py | 43 - .../v2021_08_01/workbook_managed_add.py | 61 - .../v2021_08_01/workbook_managed_get.py | 43 - .../v2021_08_01/workbook_managed_update.py | 43 - .../v2021_08_01/workbook_revision_get.py | 44 - .../v2021_08_01/workbook_revisions_list.py | 44 - .../v2021_08_01/workbook_update.py | 43 - .../v2021_08_01/workbooks_list.py | 44 - .../v2021_08_01/workbooks_list2.py | 43 - .../v2021_08_01/workbooks_list_sub.py | 43 - .../v2021_08_01/workbooks_managed_list.py | 44 - .../v2021_10/live_token_get.py | 41 - .../v2022_04_01/workbook_add.py | 54 - .../v2022_04_01/workbook_delete.py | 42 - .../v2022_04_01/workbook_get.py | 43 - .../v2022_04_01/workbook_get1.py | 43 - .../v2022_04_01/workbook_managed_add.py | 61 - .../v2022_04_01/workbook_managed_get.py | 43 - .../v2022_04_01/workbook_managed_update.py | 43 - .../v2022_04_01/workbook_revision_get.py | 44 - .../v2022_04_01/workbook_revisions_list.py | 44 - .../v2022_04_01/workbook_update.py | 43 - .../v2022_04_01/workbooks_list.py | 44 - .../v2022_04_01/workbooks_list2.py | 43 - .../v2022_04_01/workbooks_list_sub.py | 43 - .../v2022_04_01/workbooks_managed_list.py | 44 - .../v2022_06_15/web_test_create.py | 77 - .../v2022_06_15/web_test_create_standard.py | 77 - .../v2022_06_15/web_test_delete.py | 42 - .../v2022_06_15/web_test_get.py | 43 - .../v2022_06_15/web_test_list.py | 41 - .../v2022_06_15/web_test_list_by_component.py | 44 - .../web_test_list_by_resource_group.py | 43 - .../v2022_06_15/web_test_update.py | 77 - .../v2022_06_15/web_test_update_tags_only.py | 44 - .../web_test_locations_list.py | 9 +- .../work_item_config_create.py | 16 +- .../work_item_config_default_get.py | 9 +- .../work_item_config_delete.py | 9 +- .../{v2015_05_01 => }/work_item_config_get.py | 9 +- .../work_item_config_update.py | 16 +- .../work_item_configs_get.py | 9 +- .../generated_tests/conftest.py | 2 +- ...s_management_analytics_items_operations.py | 4 +- ...gement_analytics_items_operations_async.py | 4 +- ...ights_management_annotations_operations.py | 6 +- ...management_annotations_operations_async.py | 6 +- ...insights_management_api_keys_operations.py | 4 +- ...ts_management_api_keys_operations_async.py | 4 +- ...component_available_features_operations.py | 4 +- ...ent_available_features_operations_async.py | 4 +- ...ent_current_billing_features_operations.py | 4 +- ...rrent_billing_features_operations_async.py | 4 +- ...mponent_current_pricing_plan_operations.py | 79 - ...t_current_pricing_plan_operations_async.py | 80 - ...mponent_feature_capabilities_operations.py | 4 +- ...t_feature_capabilities_operations_async.py | 4 +- ...nent_linked_storage_accounts_operations.py | 16 +- ...inked_storage_accounts_operations_async.py | 16 +- ...ement_component_quota_status_operations.py | 4 +- ...component_quota_status_operations_async.py | 4 +- ...sights_management_components_operations.py | 114 +- ..._management_components_operations_async.py | 114 +- ...management_deleted_workbooks_operations.py | 2 +- ...ment_deleted_workbooks_operations_async.py | 2 +- ...cription_list_migration_date_operations.py | 29 - ...on_list_migration_date_operations_async.py | 30 - ...migrate_to_new_pricing_model_operations.py | 29 - ...e_to_new_pricing_model_operations_async.py | 30 - ...back_to_legacy_pricing_model_operations.py | 29 - ...o_legacy_pricing_model_operations_async.py | 32 - ...gement_export_configurations_operations.py | 4 +- ..._export_configurations_operations_async.py | 4 +- ...nsights_management_favorites_operations.py | 4 +- ...s_management_favorites_operations_async.py | 4 +- ...sights_management_live_token_operations.py | 4 +- ..._management_live_token_operations_async.py | 4 +- ...ghts_management_my_workbooks_operations.py | 142 - ...anagement_my_workbooks_operations_async.py | 143 - ...lication_insights_management_operations.py | 6 +- ...on_insights_management_operations_async.py | 6 +- ...ive_detection_configurations_operations.py | 26 +- ...tection_configurations_operations_async.py | 26 +- ...nsights_management_web_tests_operations.py | 82 +- ...s_management_web_tests_operations_async.py | 82 +- ...ent_work_item_configurations_operations.py | 4 +- ...rk_item_configurations_operations_async.py | 4 +- ...anagement_workbook_templates_operations.py | 82 +- ...ent_workbook_templates_operations_async.py | 82 +- ...nsights_management_workbooks_operations.py | 109 +- ...s_management_workbooks_operations_async.py | 109 +- ...anagementweb_test_locations_operations.py} | 6 +- ...entweb_test_locations_operations_async.py} | 6 +- .../tsp-location.yaml | 4 + 616 files changed, 54937 insertions(+), 96414 deletions(-) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2015_05_01/_application_insights_management_client.py => _client.py} (67%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2020_02_02 => }/_configuration.py (86%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2017_10_01 => }/_utils/__init__.py (86%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/model_base.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2015_05_01 => }/_utils/serialization.py (99%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2018_05_01_preview => }/aio/__init__.py (84%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2015_05_01/aio/_application_insights_management_client.py => aio/_client.py} (68%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2015_05_01 => }/aio/_configuration.py (86%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2015_05_01 => aio}/_patch.py (100%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_operations.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2015_05_01/aio => aio/operations}/_patch.py (100%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2015_05_01 => }/models/__init__.py (55%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_enums.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_models.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2015_05_01/aio/operations => models}/_patch.py (100%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_operations.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2015_05_01/models => operations}/_patch.py (100%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/{v2015_05_01 => }/py.typed (100%) delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_analytics_items_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_annotations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_api_keys_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_available_features_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_current_billing_features_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_feature_capabilities_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_quota_status_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_components_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_export_configurations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_favorites_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_my_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_proactive_detection_configurations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_test_locations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_tests_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_work_item_configurations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_application_insights_management_client_enums.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_analytics_items_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_annotations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_api_keys_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_available_features_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_current_billing_features_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_feature_capabilities_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_quota_status_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_components_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_export_configurations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_favorites_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_my_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_proactive_detection_configurations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_test_locations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_tests_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_work_item_configurations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_component_current_pricing_plan_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_list_migration_date_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_component_current_pricing_plan_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_list_migration_date_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_components_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_proactive_detection_configurations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_web_tests_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_application_insights_management_client_enums.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_components_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_proactive_detection_configurations_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_web_tests_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_application_insights_management_client_enums.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_workbook_templates_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_workbook_templates_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_components_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_application_insights_management_client_enums.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_components_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_components_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_application_insights_management_client_enums.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_components_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_component_linked_storage_accounts_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_application_insights_management_client_enums.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_component_linked_storage_accounts_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_live_token_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_live_token_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_workbook_templates_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_workbook_templates_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_my_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_application_insights_management_client_enums.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_my_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_application_insights_management_client_enums.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_live_token_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_live_token_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_application_insights_management_client_enums.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/py.typed delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/serialization.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_version.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_application_insights_management_client.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_configuration.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_web_tests_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_application_insights_management_client_enums.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_models_py3.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/__init__.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_patch.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_web_tests_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/py.typed create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/code_report_typespec.json rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/analytics_item_delete.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/analytics_item_get.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/analytics_item_list.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/analytics_item_put.py (86%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/annotations_create.py (69%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/annotations_delete.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/annotations_get.py (78%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/annotations_list.py (78%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/api_keys_create.py (85%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/api_keys_delete.py (78%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/api_keys_get.py (78%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/api_keys_list.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/available_billing_features_get.py (77%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_create.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2020_02_02 => }/components_delete.py (76%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/components_get.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2020_02_02 => }/components_list.py (76%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2020_02_02 => }/components_list_by_resource_group.py (76%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2020_02_02 => }/components_purge.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2020_02_02 => }/components_purge_status.py (76%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2017_10_01/current_pricing_plan_get.py => components_update.py} (69%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/components_update_tags_only.py (69%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/current_billing_features_get.py (77%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/current_billing_features_update.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/export_configuration_delete.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/export_configuration_get.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/export_configuration_update.py (60%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/export_configurations_list.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/export_configurations_post.py (59%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/favorite_add.py (93%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/favorite_delete.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/favorite_get.py (78%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/favorite_update.py (90%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/favorites_list.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/feature_capabilities_get.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/proactive_detection_configuration_get.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/proactive_detection_configuration_update.py (59%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/proactive_detection_configurations_list.py (76%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/quota_status_get.py (77%) delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_create.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list_by_resource_group.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge_status.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_add.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbooks_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_create.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_component.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_resource_group.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update_tags_only.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_add.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbooks_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_create_and_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_list_migration_date.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_migrate_to_new_pricing_model_post.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_rollback_to_legacy_pricing_model_post.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_create.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list_by_resource_group.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge_status.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update_tags_only.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/operations_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configurations_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_basic.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_standard.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_component.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_resource_group.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update_tags_only.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_add.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbooks_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_add.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_templates_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_create.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update_tags_only.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_create.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list_by_resource_group.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge_status.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update_tags_only.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_create_and_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/live_token_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/operations_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_add.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_templates_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_add.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list2.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_add.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get1.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_add.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revision_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revisions_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list2.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list_sub.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_managed_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_10/live_token_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_add.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get1.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_add.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revision_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revisions_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list2.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list_sub.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_managed_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create_standard.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_delete.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_get.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_component.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_resource_group.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update_tags_only.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/web_test_locations_list.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/work_item_config_create.py (63%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/work_item_config_default_get.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/work_item_config_delete.py (77%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/work_item_config_get.py (78%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/work_item_config_update.py (64%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/{v2015_05_01 => }/work_item_configs_get.py (77%) delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations_async.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations_async.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations_async.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations_async.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations.py delete mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations_async.py rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/{test_application_insights_management_web_test_locations_operations.py => test_application_insights_managementweb_test_locations_operations.py} (85%) rename sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/{test_application_insights_management_web_test_locations_operations_async.py => test_application_insights_managementweb_test_locations_operations_async.py} (85%) create mode 100644 sdk/applicationinsights/azure-mgmt-applicationinsights/tsp-location.yaml diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/_metadata.json b/sdk/applicationinsights/azure-mgmt-applicationinsights/_metadata.json index 731c163a4bba..909b77b6dabd 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/_metadata.json +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/_metadata.json @@ -1,11 +1,20 @@ { - "commit": "5ce63776b93010e2ef6ba8d14b79b3b95bdc47d6", + "apiVersions": { + "AnalyticsItems": "2015-05-01", + "ComponentAPIs": "2015-05-01", + "ComponentLinkedStorageAccountApi": "2020-03-01-preview", + "Components": "2020-02-02", + "DeletedWorkbookApi": "2024-02-01-preview", + "Favorites": "2015-05-01", + "LiveTokenApi": "2021-10-14", + "Microsoft.Insights": "2022-06-15", + "WebTestLocation": "2015-05-01", + "WorkBookOperations": "2021-03-08", + "WorkbookTemplatesApi": "2020-11-20", + "WorkbooksApi": "2023-06-01" + }, + "commit": "99c35678fdca0ced74272dbf4513f6220db26593", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.50.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/applicationinsights/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=/home/v-chenjiang/worktrees/sdk-azure-mgmt-applicationinsights/sdk --use=@autorest/python@6.50.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/applicationinsights/resource-manager/readme.md" + "typespec_src": "specification/applicationinsights/resource-manager/Microsoft.Insights/ApplicationInsights", + "emitterVersion": "0.61.1" } \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/apiview-properties.json b/sdk/applicationinsights/azure-mgmt-applicationinsights/apiview-properties.json index fdfc3cb7444d..33f8958ccc9d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/apiview-properties.json +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/apiview-properties.json @@ -1,30 +1,254 @@ { - "CrossLanguagePackageId": null, + "CrossLanguagePackageId": "AnalyticsItems", "CrossLanguageDefinitionId": { - "azure.mgmt.applicationinsights.v2022_06_15.models.HeaderField": null, - "azure.mgmt.applicationinsights.v2022_06_15.models.TagsResource": null, - "azure.mgmt.applicationinsights.v2022_06_15.models.WebtestsResource": null, - "azure.mgmt.applicationinsights.v2022_06_15.models.WebTest": null, - "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestGeolocation": null, - "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestListResult": null, - "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesConfiguration": null, - "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesRequest": null, - "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRules": null, - "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRulesContentValidation": null, - "azure.mgmt.applicationinsights.v2022_06_15.models.WebTestKind": null, - "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.list_by_resource_group": null, - "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.list_by_resource_group": null, - "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.get": null, - "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.get": null, - "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.create_or_update": null, - "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.create_or_update": null, - "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.update_tags": null, - "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.update_tags": null, - "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.delete": null, - "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.delete": null, - "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.list": null, - "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.list": null, - "azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations.list_by_component": null, - "azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations.list_by_component": null + "azure.mgmt.applicationinsights.models.Annotation": "ComponentAPIs.Annotation", + "azure.mgmt.applicationinsights.models.AnnotationError": "ComponentAPIs.AnnotationError", + "azure.mgmt.applicationinsights.models.APIKeyRequest": "ComponentAPIs.APIKeyRequest", + "azure.mgmt.applicationinsights.models.ComponentsResource": "Components.ComponentsResource", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponent": "Components.ApplicationInsightsComponent", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem": "AnalyticsItems.ApplicationInsightsComponentAnalyticsItem", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItemProperties": "AnalyticsItems.ApplicationInsightsComponentAnalyticsItemProperties", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey": "ComponentAPIs.ApplicationInsightsComponentAPIKey", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAvailableFeatures": "ComponentAPIs.ApplicationInsightsComponentAvailableFeatures", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures": "ComponentAPIs.ApplicationInsightsComponentBillingFeatures", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentDataVolumeCap": "ComponentAPIs.ApplicationInsightsComponentDataVolumeCap", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration": "ComponentAPIs.ApplicationInsightsComponentExportConfiguration", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest": "ComponentAPIs.ApplicationInsightsComponentExportRequest", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite": "Favorites.ApplicationInsightsComponentFavorite", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeature": "ComponentAPIs.ApplicationInsightsComponentFeature", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeatureCapabilities": "ComponentAPIs.ApplicationInsightsComponentFeatureCapabilities", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeatureCapability": "ComponentAPIs.ApplicationInsightsComponentFeatureCapability", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration": "ComponentAPIs.ApplicationInsightsComponentProactiveDetectionConfiguration", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions": "ComponentAPIs.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProperties": "Components.ApplicationInsightsComponentProperties", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentQuotaStatus": "ComponentAPIs.ApplicationInsightsComponentQuotaStatus", + "azure.mgmt.applicationinsights.models.ApplicationInsightsComponentWebTestLocation": "WebTestLocation.ApplicationInsightsComponentWebTestLocation", + "azure.mgmt.applicationinsights.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.applicationinsights.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts": "ComponentLinkedStorageAccountApi.ComponentLinkedStorageAccounts", + "azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccountsPatch": "ComponentLinkedStorageAccountApi.ComponentLinkedStorageAccountsPatch", + "azure.mgmt.applicationinsights.models.ComponentPurgeBody": "Components.ComponentPurgeBody", + "azure.mgmt.applicationinsights.models.ComponentPurgeBodyFilters": "Components.ComponentPurgeBodyFilters", + "azure.mgmt.applicationinsights.models.ComponentPurgeResponse": "Components.ComponentPurgeResponse", + "azure.mgmt.applicationinsights.models.ComponentPurgeStatusResponse": "Components.ComponentPurgeStatusResponse", + "azure.mgmt.applicationinsights.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.applicationinsights.models.DeletedWorkbookResource": "DeletedWorkbookApi.DeletedWorkbookResource", + "azure.mgmt.applicationinsights.models.DeletedWorkbook": "DeletedWorkbookApi.DeletedWorkbook", + "azure.mgmt.applicationinsights.models.DeletedWorkbookError": "DeletedWorkbookApi.DeletedWorkbookError", + "azure.mgmt.applicationinsights.models.DeletedWorkbookErrorDefinition": "DeletedWorkbookApi.DeletedWorkbookErrorDefinition", + "azure.mgmt.applicationinsights.models.DeletedWorkbookInnerErrorTrace": "DeletedWorkbookApi.DeletedWorkbookInnerErrorTrace", + "azure.mgmt.applicationinsights.models.DeletedWorkbookProperties": "DeletedWorkbookApi.DeletedWorkbookProperties", + "azure.mgmt.applicationinsights.models.ErrorFieldContract": "WorkBookOperations.ErrorFieldContract", + "azure.mgmt.applicationinsights.models.ErrorResponse": "WorkBookOperations.ErrorResponse", + "azure.mgmt.applicationinsights.models.ErrorResponseComponents": "Components.ErrorResponseComponents", + "azure.mgmt.applicationinsights.models.ErrorResponseComponentsError": "Components.ErrorResponseComponentsError", + "azure.mgmt.applicationinsights.models.ErrorResponseLinkedStorage": "ComponentLinkedStorageAccountApi.ErrorResponseLinkedStorage", + "azure.mgmt.applicationinsights.models.ErrorResponseLinkedStorageError": "ComponentLinkedStorageAccountApi.ErrorResponseLinkedStorageError", + "azure.mgmt.applicationinsights.models.HeaderField": "Microsoft.Insights.HeaderField", + "azure.mgmt.applicationinsights.models.InnerError": "ComponentAPIs.InnerError", + "azure.mgmt.applicationinsights.models.LinkedStorageAccountsProperties": "ComponentLinkedStorageAccountApi.LinkedStorageAccountsProperties", + "azure.mgmt.applicationinsights.models.LiveTokenErrorResponseLinkedStorage": "LiveTokenApi.ErrorResponseLinkedStorage", + "azure.mgmt.applicationinsights.models.LiveTokenErrorResponseLinkedStorageError": "LiveTokenApi.ErrorResponseLinkedStorageError", + "azure.mgmt.applicationinsights.models.LiveTokenResponse": "LiveTokenApi.LiveTokenResponse", + "azure.mgmt.applicationinsights.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "azure.mgmt.applicationinsights.models.Operation": "WorkBookOperations.Operation", + "azure.mgmt.applicationinsights.models.OperationDisplay": "WorkBookOperations.OperationDisplay", + "azure.mgmt.applicationinsights.models.PrivateLinkScopedResource": "Components.PrivateLinkScopedResource", + "azure.mgmt.applicationinsights.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.applicationinsights.models.TagsResource": "Components.TagsResource", + "azure.mgmt.applicationinsights.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "azure.mgmt.applicationinsights.models.WebtestsResource": "Microsoft.Insights.WebtestsResource", + "azure.mgmt.applicationinsights.models.WebTest": "Microsoft.Insights.WebTest", + "azure.mgmt.applicationinsights.models.WebTestGeolocation": "Microsoft.Insights.WebTestGeolocation", + "azure.mgmt.applicationinsights.models.WebTestProperties": "Microsoft.Insights.WebTestProperties", + "azure.mgmt.applicationinsights.models.WebTestPropertiesConfiguration": "Microsoft.Insights.WebTestPropertiesConfiguration", + "azure.mgmt.applicationinsights.models.WebTestPropertiesRequest": "Microsoft.Insights.WebTestPropertiesRequest", + "azure.mgmt.applicationinsights.models.WebTestPropertiesValidationRules": "Microsoft.Insights.WebTestPropertiesValidationRules", + "azure.mgmt.applicationinsights.models.WebTestPropertiesValidationRulesContentValidation": "Microsoft.Insights.WebTestPropertiesValidationRulesContentValidation", + "azure.mgmt.applicationinsights.models.WebTestTagsResource": "Microsoft.Insights.TagsResource", + "azure.mgmt.applicationinsights.models.Workbook": "WorkbooksApi.Workbook", + "azure.mgmt.applicationinsights.models.WorkbookError": "WorkbooksApi.WorkbookError", + "azure.mgmt.applicationinsights.models.WorkbookErrorDefinition": "WorkbooksApi.WorkbookErrorDefinition", + "azure.mgmt.applicationinsights.models.WorkbookInnerErrorTrace": "WorkbooksApi.WorkbookInnerErrorTrace", + "azure.mgmt.applicationinsights.models.WorkbookProperties": "WorkbooksApi.WorkbookProperties", + "azure.mgmt.applicationinsights.models.WorkbookPropertiesUpdateParameters": "WorkbooksApi.WorkbookPropertiesUpdateParameters", + "azure.mgmt.applicationinsights.models.WorkbookResourceIdentity": "WorkbooksApi.WorkbookResourceIdentity", + "azure.mgmt.applicationinsights.models.WorkbookTemplate": "WorkbookTemplatesApi.WorkbookTemplate", + "azure.mgmt.applicationinsights.models.WorkbookTemplateError": "WorkbookTemplatesApi.WorkbookTemplateError", + "azure.mgmt.applicationinsights.models.WorkbookTemplateErrorBody": "WorkbookTemplatesApi.WorkbookTemplateErrorBody", + "azure.mgmt.applicationinsights.models.WorkbookTemplateErrorFieldContract": "WorkbookTemplatesApi.WorkbookTemplateErrorFieldContract", + "azure.mgmt.applicationinsights.models.WorkbookTemplateGallery": "WorkbookTemplatesApi.WorkbookTemplateGallery", + "azure.mgmt.applicationinsights.models.WorkbookTemplateLocalizedGallery": "WorkbookTemplatesApi.WorkbookTemplateLocalizedGallery", + "azure.mgmt.applicationinsights.models.WorkbookTemplateProperties": "WorkbookTemplatesApi.WorkbookTemplateProperties", + "azure.mgmt.applicationinsights.models.WorkbookTemplateUpdateParameters": "WorkbookTemplatesApi.WorkbookTemplateUpdateParameters", + "azure.mgmt.applicationinsights.models.WorkbookUpdateParameters": "WorkbooksApi.WorkbookUpdateParameters", + "azure.mgmt.applicationinsights.models.WorkItemConfiguration": "ComponentAPIs.WorkItemConfiguration", + "azure.mgmt.applicationinsights.models.WorkItemConfigurationError": "ComponentAPIs.WorkItemConfigurationError", + "azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration": "ComponentAPIs.WorkItemCreateConfiguration", + "azure.mgmt.applicationinsights.models.WebTestKind": "Microsoft.Insights.WebTestKind", + "azure.mgmt.applicationinsights.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.applicationinsights.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "azure.mgmt.applicationinsights.models.WorkbookSharedTypeKind": "WorkbooksApi.WorkbookSharedTypeKind", + "azure.mgmt.applicationinsights.models.WorkbookUpdateSharedTypeKind": "WorkbooksApi.WorkbookUpdateSharedTypeKind", + "azure.mgmt.applicationinsights.models.CategoryType": "WorkbooksApi.CategoryType", + "azure.mgmt.applicationinsights.models.ItemScope": "AnalyticsItems.ItemScope", + "azure.mgmt.applicationinsights.models.ItemType": "AnalyticsItems.ItemType", + "azure.mgmt.applicationinsights.models.ItemScopePath": "AnalyticsItems.ItemScopePath", + "azure.mgmt.applicationinsights.models.ItemTypeParameter": "AnalyticsItems.ItemTypeParameter", + "azure.mgmt.applicationinsights.models.StorageType": "ComponentLinkedStorageAccountApi.StorageType", + "azure.mgmt.applicationinsights.models.ApplicationType": "Components.ApplicationType", + "azure.mgmt.applicationinsights.models.FlowType": "Components.FlowType", + "azure.mgmt.applicationinsights.models.RequestSource": "Components.RequestSource", + "azure.mgmt.applicationinsights.models.PublicNetworkAccessType": "Components.PublicNetworkAccessType", + "azure.mgmt.applicationinsights.models.IngestionMode": "Components.IngestionMode", + "azure.mgmt.applicationinsights.models.PurgeState": "Components.PurgeState", + "azure.mgmt.applicationinsights.models.DeletedWorkbookSharedTypeKind": "DeletedWorkbookApi.WorkbookSharedTypeKind", + "azure.mgmt.applicationinsights.models.DeletedWorkbookCategoryType": "DeletedWorkbookApi.CategoryType", + "azure.mgmt.applicationinsights.models.FavoriteType": "Favorites.FavoriteType", + "azure.mgmt.applicationinsights.models.FavoriteSourceType": "Favorites.FavoriteSourceType", + "azure.mgmt.applicationinsights.operations.WebTestsOperations.get": "Microsoft.Insights.WebTests.get", + "azure.mgmt.applicationinsights.aio.operations.WebTestsOperations.get": "Microsoft.Insights.WebTests.get", + "azure.mgmt.applicationinsights.operations.WebTestsOperations.create_or_update": "Microsoft.Insights.WebTests.createOrUpdate", + "azure.mgmt.applicationinsights.aio.operations.WebTestsOperations.create_or_update": "Microsoft.Insights.WebTests.createOrUpdate", + "azure.mgmt.applicationinsights.operations.WebTestsOperations.update_tags": "Microsoft.Insights.WebTests.updateTags", + "azure.mgmt.applicationinsights.aio.operations.WebTestsOperations.update_tags": "Microsoft.Insights.WebTests.updateTags", + "azure.mgmt.applicationinsights.operations.WebTestsOperations.delete": "Microsoft.Insights.WebTests.delete", + "azure.mgmt.applicationinsights.aio.operations.WebTestsOperations.delete": "Microsoft.Insights.WebTests.delete", + "azure.mgmt.applicationinsights.operations.WebTestsOperations.list_by_resource_group": "Microsoft.Insights.WebTests.listByResourceGroup", + "azure.mgmt.applicationinsights.aio.operations.WebTestsOperations.list_by_resource_group": "Microsoft.Insights.WebTests.listByResourceGroup", + "azure.mgmt.applicationinsights.operations.WebTestsOperations.list": "Microsoft.Insights.WebTests.list", + "azure.mgmt.applicationinsights.aio.operations.WebTestsOperations.list": "Microsoft.Insights.WebTests.list", + "azure.mgmt.applicationinsights.operations.WebTestsOperations.list_by_component": "Microsoft.Insights.WebTestsOperationGroup.listByComponent", + "azure.mgmt.applicationinsights.aio.operations.WebTestsOperations.list_by_component": "Microsoft.Insights.WebTestsOperationGroup.listByComponent", + "azure.mgmt.applicationinsights.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.applicationinsights.aio.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.applicationinsights.operations.WorkbooksOperations.get": "WorkbooksApi.Workbooks.get", + "azure.mgmt.applicationinsights.aio.operations.WorkbooksOperations.get": "WorkbooksApi.Workbooks.get", + "azure.mgmt.applicationinsights.operations.WorkbooksOperations.create_or_update": "WorkbooksApi.Workbooks.createOrUpdate", + "azure.mgmt.applicationinsights.aio.operations.WorkbooksOperations.create_or_update": "WorkbooksApi.Workbooks.createOrUpdate", + "azure.mgmt.applicationinsights.operations.WorkbooksOperations.update": "WorkbooksApi.Workbooks.update", + "azure.mgmt.applicationinsights.aio.operations.WorkbooksOperations.update": "WorkbooksApi.Workbooks.update", + "azure.mgmt.applicationinsights.operations.WorkbooksOperations.delete": "WorkbooksApi.Workbooks.delete", + "azure.mgmt.applicationinsights.aio.operations.WorkbooksOperations.delete": "WorkbooksApi.Workbooks.delete", + "azure.mgmt.applicationinsights.operations.WorkbooksOperations.list_by_subscription": "WorkbooksApi.Workbooks.listBySubscription", + "azure.mgmt.applicationinsights.aio.operations.WorkbooksOperations.list_by_subscription": "WorkbooksApi.Workbooks.listBySubscription", + "azure.mgmt.applicationinsights.operations.WorkbooksOperations.revisions_list": "WorkbooksApi.Workbooks.revisionsList", + "azure.mgmt.applicationinsights.aio.operations.WorkbooksOperations.revisions_list": "WorkbooksApi.Workbooks.revisionsList", + "azure.mgmt.applicationinsights.operations.WorkbooksOperations.revision_get": "WorkbooksApi.WorkbookOperationGroup.revisionGet", + "azure.mgmt.applicationinsights.aio.operations.WorkbooksOperations.revision_get": "WorkbooksApi.WorkbookOperationGroup.revisionGet", + "azure.mgmt.applicationinsights.operations.WorkbooksOperations.list_by_resource_group": "WorkbooksApi.WorkbookOperationGroup.listByResourceGroup", + "azure.mgmt.applicationinsights.aio.operations.WorkbooksOperations.list_by_resource_group": "WorkbooksApi.WorkbookOperationGroup.listByResourceGroup", + "azure.mgmt.applicationinsights.operations.WorkbookTemplatesOperations.get": "WorkbookTemplatesApi.WorkbookTemplates.get", + "azure.mgmt.applicationinsights.aio.operations.WorkbookTemplatesOperations.get": "WorkbookTemplatesApi.WorkbookTemplates.get", + "azure.mgmt.applicationinsights.operations.WorkbookTemplatesOperations.create_or_update": "WorkbookTemplatesApi.WorkbookTemplates.createOrUpdate", + "azure.mgmt.applicationinsights.aio.operations.WorkbookTemplatesOperations.create_or_update": "WorkbookTemplatesApi.WorkbookTemplates.createOrUpdate", + "azure.mgmt.applicationinsights.operations.WorkbookTemplatesOperations.update": "WorkbookTemplatesApi.WorkbookTemplates.update", + "azure.mgmt.applicationinsights.aio.operations.WorkbookTemplatesOperations.update": "WorkbookTemplatesApi.WorkbookTemplates.update", + "azure.mgmt.applicationinsights.operations.WorkbookTemplatesOperations.delete": "WorkbookTemplatesApi.WorkbookTemplates.delete", + "azure.mgmt.applicationinsights.aio.operations.WorkbookTemplatesOperations.delete": "WorkbookTemplatesApi.WorkbookTemplates.delete", + "azure.mgmt.applicationinsights.operations.WorkbookTemplatesOperations.list_by_resource_group": "WorkbookTemplatesApi.WorkbookTemplates.listByResourceGroup", + "azure.mgmt.applicationinsights.aio.operations.WorkbookTemplatesOperations.list_by_resource_group": "WorkbookTemplatesApi.WorkbookTemplates.listByResourceGroup", + "azure.mgmt.applicationinsights.operations.AnalyticsItemsOperations.list": "AnalyticsItems.AnalyticsItemsOperationGroup.list", + "azure.mgmt.applicationinsights.aio.operations.AnalyticsItemsOperations.list": "AnalyticsItems.AnalyticsItemsOperationGroup.list", + "azure.mgmt.applicationinsights.operations.AnalyticsItemsOperations.get": "AnalyticsItems.AnalyticsItemsOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.AnalyticsItemsOperations.get": "AnalyticsItems.AnalyticsItemsOperationGroup.get", + "azure.mgmt.applicationinsights.operations.AnalyticsItemsOperations.put": "AnalyticsItems.AnalyticsItemsOperationGroup.put", + "azure.mgmt.applicationinsights.aio.operations.AnalyticsItemsOperations.put": "AnalyticsItems.AnalyticsItemsOperationGroup.put", + "azure.mgmt.applicationinsights.operations.AnalyticsItemsOperations.delete": "AnalyticsItems.AnalyticsItemsOperationGroup.delete", + "azure.mgmt.applicationinsights.aio.operations.AnalyticsItemsOperations.delete": "AnalyticsItems.AnalyticsItemsOperationGroup.delete", + "azure.mgmt.applicationinsights.operations.AnnotationsOperations.list": "ComponentAPIs.AnnotationsOperationGroup.list", + "azure.mgmt.applicationinsights.aio.operations.AnnotationsOperations.list": "ComponentAPIs.AnnotationsOperationGroup.list", + "azure.mgmt.applicationinsights.operations.AnnotationsOperations.create": "ComponentAPIs.AnnotationsOperationGroup.create", + "azure.mgmt.applicationinsights.aio.operations.AnnotationsOperations.create": "ComponentAPIs.AnnotationsOperationGroup.create", + "azure.mgmt.applicationinsights.operations.AnnotationsOperations.delete": "ComponentAPIs.AnnotationsOperationGroup.delete", + "azure.mgmt.applicationinsights.aio.operations.AnnotationsOperations.delete": "ComponentAPIs.AnnotationsOperationGroup.delete", + "azure.mgmt.applicationinsights.operations.AnnotationsOperations.get": "ComponentAPIs.AnnotationsOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.AnnotationsOperations.get": "ComponentAPIs.AnnotationsOperationGroup.get", + "azure.mgmt.applicationinsights.operations.APIKeysOperations.list": "ComponentAPIs.APIKeysOperationGroup.list", + "azure.mgmt.applicationinsights.aio.operations.APIKeysOperations.list": "ComponentAPIs.APIKeysOperationGroup.list", + "azure.mgmt.applicationinsights.operations.APIKeysOperations.create": "ComponentAPIs.APIKeysOperationGroup.create", + "azure.mgmt.applicationinsights.aio.operations.APIKeysOperations.create": "ComponentAPIs.APIKeysOperationGroup.create", + "azure.mgmt.applicationinsights.operations.APIKeysOperations.delete": "ComponentAPIs.APIKeysOperationGroup.delete", + "azure.mgmt.applicationinsights.aio.operations.APIKeysOperations.delete": "ComponentAPIs.APIKeysOperationGroup.delete", + "azure.mgmt.applicationinsights.operations.APIKeysOperations.get": "ComponentAPIs.APIKeysOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.APIKeysOperations.get": "ComponentAPIs.APIKeysOperationGroup.get", + "azure.mgmt.applicationinsights.operations.ExportConfigurationsOperations.list": "ComponentAPIs.ExportConfigurationsOperationGroup.list", + "azure.mgmt.applicationinsights.aio.operations.ExportConfigurationsOperations.list": "ComponentAPIs.ExportConfigurationsOperationGroup.list", + "azure.mgmt.applicationinsights.operations.ExportConfigurationsOperations.create": "ComponentAPIs.ExportConfigurationsOperationGroup.create", + "azure.mgmt.applicationinsights.aio.operations.ExportConfigurationsOperations.create": "ComponentAPIs.ExportConfigurationsOperationGroup.create", + "azure.mgmt.applicationinsights.operations.ExportConfigurationsOperations.delete": "ComponentAPIs.ExportConfigurationsOperationGroup.delete", + "azure.mgmt.applicationinsights.aio.operations.ExportConfigurationsOperations.delete": "ComponentAPIs.ExportConfigurationsOperationGroup.delete", + "azure.mgmt.applicationinsights.operations.ExportConfigurationsOperations.get": "ComponentAPIs.ExportConfigurationsOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.ExportConfigurationsOperations.get": "ComponentAPIs.ExportConfigurationsOperationGroup.get", + "azure.mgmt.applicationinsights.operations.ExportConfigurationsOperations.update": "ComponentAPIs.ExportConfigurationsOperationGroup.update", + "azure.mgmt.applicationinsights.aio.operations.ExportConfigurationsOperations.update": "ComponentAPIs.ExportConfigurationsOperationGroup.update", + "azure.mgmt.applicationinsights.operations.ComponentCurrentBillingFeaturesOperations.get": "ComponentAPIs.ComponentCurrentBillingFeaturesOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.ComponentCurrentBillingFeaturesOperations.get": "ComponentAPIs.ComponentCurrentBillingFeaturesOperationGroup.get", + "azure.mgmt.applicationinsights.operations.ComponentCurrentBillingFeaturesOperations.update": "ComponentAPIs.ComponentCurrentBillingFeaturesOperationGroup.update", + "azure.mgmt.applicationinsights.aio.operations.ComponentCurrentBillingFeaturesOperations.update": "ComponentAPIs.ComponentCurrentBillingFeaturesOperationGroup.update", + "azure.mgmt.applicationinsights.operations.ComponentQuotaStatusOperations.get": "ComponentAPIs.ComponentQuotaStatusOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.ComponentQuotaStatusOperations.get": "ComponentAPIs.ComponentQuotaStatusOperationGroup.get", + "azure.mgmt.applicationinsights.operations.ComponentFeatureCapabilitiesOperations.get": "ComponentAPIs.ComponentFeatureCapabilitiesOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.ComponentFeatureCapabilitiesOperations.get": "ComponentAPIs.ComponentFeatureCapabilitiesOperationGroup.get", + "azure.mgmt.applicationinsights.operations.ComponentAvailableFeaturesOperations.get": "ComponentAPIs.ComponentAvailableFeaturesOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.ComponentAvailableFeaturesOperations.get": "ComponentAPIs.ComponentAvailableFeaturesOperationGroup.get", + "azure.mgmt.applicationinsights.operations.ProactiveDetectionConfigurationsOperations.list": "ComponentAPIs.ProactiveDetectionConfigurationsOperationGroup.list", + "azure.mgmt.applicationinsights.aio.operations.ProactiveDetectionConfigurationsOperations.list": "ComponentAPIs.ProactiveDetectionConfigurationsOperationGroup.list", + "azure.mgmt.applicationinsights.operations.ProactiveDetectionConfigurationsOperations.get": "ComponentAPIs.ProactiveDetectionConfigurationsOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.ProactiveDetectionConfigurationsOperations.get": "ComponentAPIs.ProactiveDetectionConfigurationsOperationGroup.get", + "azure.mgmt.applicationinsights.operations.ProactiveDetectionConfigurationsOperations.update": "ComponentAPIs.ProactiveDetectionConfigurationsOperationGroup.update", + "azure.mgmt.applicationinsights.aio.operations.ProactiveDetectionConfigurationsOperations.update": "ComponentAPIs.ProactiveDetectionConfigurationsOperationGroup.update", + "azure.mgmt.applicationinsights.operations.WorkItemConfigurationsOperations.list": "ComponentAPIs.WorkItemConfigurationsOperationGroup.list", + "azure.mgmt.applicationinsights.aio.operations.WorkItemConfigurationsOperations.list": "ComponentAPIs.WorkItemConfigurationsOperationGroup.list", + "azure.mgmt.applicationinsights.operations.WorkItemConfigurationsOperations.create": "ComponentAPIs.WorkItemConfigurationsOperationGroup.create", + "azure.mgmt.applicationinsights.aio.operations.WorkItemConfigurationsOperations.create": "ComponentAPIs.WorkItemConfigurationsOperationGroup.create", + "azure.mgmt.applicationinsights.operations.WorkItemConfigurationsOperations.get_default": "ComponentAPIs.WorkItemConfigurationsOperationGroup.getDefault", + "azure.mgmt.applicationinsights.aio.operations.WorkItemConfigurationsOperations.get_default": "ComponentAPIs.WorkItemConfigurationsOperationGroup.getDefault", + "azure.mgmt.applicationinsights.operations.WorkItemConfigurationsOperations.delete": "ComponentAPIs.WorkItemConfigurationsOperationGroup.delete", + "azure.mgmt.applicationinsights.aio.operations.WorkItemConfigurationsOperations.delete": "ComponentAPIs.WorkItemConfigurationsOperationGroup.delete", + "azure.mgmt.applicationinsights.operations.WorkItemConfigurationsOperations.get_item": "ComponentAPIs.WorkItemConfigurationsOperationGroup.getItem", + "azure.mgmt.applicationinsights.aio.operations.WorkItemConfigurationsOperations.get_item": "ComponentAPIs.WorkItemConfigurationsOperationGroup.getItem", + "azure.mgmt.applicationinsights.operations.WorkItemConfigurationsOperations.update_item": "ComponentAPIs.WorkItemConfigurationsOperationGroup.updateItem", + "azure.mgmt.applicationinsights.aio.operations.WorkItemConfigurationsOperations.update_item": "ComponentAPIs.WorkItemConfigurationsOperationGroup.updateItem", + "azure.mgmt.applicationinsights.operations.ComponentLinkedStorageAccountsOperations.get": "ComponentLinkedStorageAccountApi.ComponentLinkedStorageAccountsOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.ComponentLinkedStorageAccountsOperations.get": "ComponentLinkedStorageAccountApi.ComponentLinkedStorageAccountsOperationGroup.get", + "azure.mgmt.applicationinsights.operations.ComponentLinkedStorageAccountsOperations.create_and_update": "ComponentLinkedStorageAccountApi.ComponentLinkedStorageAccountsOperationGroup.createAndUpdate", + "azure.mgmt.applicationinsights.aio.operations.ComponentLinkedStorageAccountsOperations.create_and_update": "ComponentLinkedStorageAccountApi.ComponentLinkedStorageAccountsOperationGroup.createAndUpdate", + "azure.mgmt.applicationinsights.operations.ComponentLinkedStorageAccountsOperations.update": "ComponentLinkedStorageAccountApi.ComponentLinkedStorageAccountsOperationGroup.update", + "azure.mgmt.applicationinsights.aio.operations.ComponentLinkedStorageAccountsOperations.update": "ComponentLinkedStorageAccountApi.ComponentLinkedStorageAccountsOperationGroup.update", + "azure.mgmt.applicationinsights.operations.ComponentLinkedStorageAccountsOperations.delete": "ComponentLinkedStorageAccountApi.ComponentLinkedStorageAccountsOperationGroup.delete", + "azure.mgmt.applicationinsights.aio.operations.ComponentLinkedStorageAccountsOperations.delete": "ComponentLinkedStorageAccountApi.ComponentLinkedStorageAccountsOperationGroup.delete", + "azure.mgmt.applicationinsights.operations.ComponentsOperations.get": "Components.ApplicationInsightsComponents.get", + "azure.mgmt.applicationinsights.aio.operations.ComponentsOperations.get": "Components.ApplicationInsightsComponents.get", + "azure.mgmt.applicationinsights.operations.ComponentsOperations.create_or_update": "Components.ApplicationInsightsComponents.createOrUpdate", + "azure.mgmt.applicationinsights.aio.operations.ComponentsOperations.create_or_update": "Components.ApplicationInsightsComponents.createOrUpdate", + "azure.mgmt.applicationinsights.operations.ComponentsOperations.update_tags": "Components.ApplicationInsightsComponents.updateTags", + "azure.mgmt.applicationinsights.aio.operations.ComponentsOperations.update_tags": "Components.ApplicationInsightsComponents.updateTags", + "azure.mgmt.applicationinsights.operations.ComponentsOperations.delete": "Components.ApplicationInsightsComponents.delete", + "azure.mgmt.applicationinsights.aio.operations.ComponentsOperations.delete": "Components.ApplicationInsightsComponents.delete", + "azure.mgmt.applicationinsights.operations.ComponentsOperations.list_by_resource_group": "Components.ApplicationInsightsComponents.listByResourceGroup", + "azure.mgmt.applicationinsights.aio.operations.ComponentsOperations.list_by_resource_group": "Components.ApplicationInsightsComponents.listByResourceGroup", + "azure.mgmt.applicationinsights.operations.ComponentsOperations.list": "Components.ApplicationInsightsComponents.list", + "azure.mgmt.applicationinsights.aio.operations.ComponentsOperations.list": "Components.ApplicationInsightsComponents.list", + "azure.mgmt.applicationinsights.operations.ComponentsOperations.purge": "Components.ApplicationInsightsComponents.purge", + "azure.mgmt.applicationinsights.aio.operations.ComponentsOperations.purge": "Components.ApplicationInsightsComponents.purge", + "azure.mgmt.applicationinsights.operations.ComponentsOperations.get_purge_status": "Components.ComponentPurgeStatusOperationGroup.getPurgeStatus", + "azure.mgmt.applicationinsights.aio.operations.ComponentsOperations.get_purge_status": "Components.ComponentPurgeStatusOperationGroup.getPurgeStatus", + "azure.mgmt.applicationinsights.operations.DeletedWorkbooksOperations.list_by_subscription": "DeletedWorkbookApi.DeletedWorkbooksOperationGroup.listBySubscription", + "azure.mgmt.applicationinsights.aio.operations.DeletedWorkbooksOperations.list_by_subscription": "DeletedWorkbookApi.DeletedWorkbooksOperationGroup.listBySubscription", + "azure.mgmt.applicationinsights.operations.FavoritesOperations.list": "Favorites.FavoritesOperationGroup.list", + "azure.mgmt.applicationinsights.aio.operations.FavoritesOperations.list": "Favorites.FavoritesOperationGroup.list", + "azure.mgmt.applicationinsights.operations.FavoritesOperations.get": "Favorites.FavoritesOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.FavoritesOperations.get": "Favorites.FavoritesOperationGroup.get", + "azure.mgmt.applicationinsights.operations.FavoritesOperations.add": "Favorites.FavoritesOperationGroup.add", + "azure.mgmt.applicationinsights.aio.operations.FavoritesOperations.add": "Favorites.FavoritesOperationGroup.add", + "azure.mgmt.applicationinsights.operations.FavoritesOperations.update": "Favorites.FavoritesOperationGroup.update", + "azure.mgmt.applicationinsights.aio.operations.FavoritesOperations.update": "Favorites.FavoritesOperationGroup.update", + "azure.mgmt.applicationinsights.operations.FavoritesOperations.delete": "Favorites.FavoritesOperationGroup.delete", + "azure.mgmt.applicationinsights.aio.operations.FavoritesOperations.delete": "Favorites.FavoritesOperationGroup.delete", + "azure.mgmt.applicationinsights.operations.LiveTokenOperations.get": "LiveTokenApi.LiveTokenOperationGroup.get", + "azure.mgmt.applicationinsights.aio.operations.LiveTokenOperations.get": "LiveTokenApi.LiveTokenOperationGroup.get", + "azure.mgmt.applicationinsights.operations.webTestLocationsOperations.list": "WebTestLocation.webTestLocationsOperationGroup.list", + "azure.mgmt.applicationinsights.aio.operations.webTestLocationsOperations.list": "WebTestLocation.webTestLocationsOperationGroup.list" } } \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/__init__.py index 35bb7b7a2fb1..6717088b3735 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/__init__.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/__init__.py @@ -1,2 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import ApplicationInsightsManagementClient # type: ignore from ._version import VERSION + __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ApplicationInsightsManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_client.py similarity index 67% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_application_insights_management_client.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_client.py index f90c2040f13e..2b6d07702a61 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_application_insights_management_client.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_client.py @@ -1,8 +1,9 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,7 +18,6 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models from ._configuration import ApplicationInsightsManagementClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( @@ -27,17 +27,20 @@ ComponentAvailableFeaturesOperations, ComponentCurrentBillingFeaturesOperations, ComponentFeatureCapabilitiesOperations, + ComponentLinkedStorageAccountsOperations, ComponentQuotaStatusOperations, ComponentsOperations, + DeletedWorkbooksOperations, ExportConfigurationsOperations, FavoritesOperations, - MyWorkbooksOperations, + LiveTokenOperations, Operations, ProactiveDetectionConfigurationsOperations, - WebTestLocationsOperations, WebTestsOperations, WorkItemConfigurationsOperations, + WorkbookTemplatesOperations, WorkbooksOperations, + webTestLocationsOperations, ) if TYPE_CHECKING: @@ -45,66 +48,69 @@ from azure.core.credentials import TokenCredential -class ApplicationInsightsManagementClient: # pylint: disable=too-many-instance-attributes - """Composite Swagger for Application Insights Management Client. +class ApplicationInsightsManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """ApplicationInsightsManagementClient. + :ivar web_tests: WebTestsOperations operations + :vartype web_tests: azure.mgmt.applicationinsights.operations.WebTestsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.applicationinsights.v2015_05_01.operations.Operations + :vartype operations: azure.mgmt.applicationinsights.operations.Operations + :ivar workbooks: WorkbooksOperations operations + :vartype workbooks: azure.mgmt.applicationinsights.operations.WorkbooksOperations + :ivar workbook_templates: WorkbookTemplatesOperations operations + :vartype workbook_templates: + azure.mgmt.applicationinsights.operations.WorkbookTemplatesOperations + :ivar analytics_items: AnalyticsItemsOperations operations + :vartype analytics_items: azure.mgmt.applicationinsights.operations.AnalyticsItemsOperations :ivar annotations: AnnotationsOperations operations - :vartype annotations: - azure.mgmt.applicationinsights.v2015_05_01.operations.AnnotationsOperations + :vartype annotations: azure.mgmt.applicationinsights.operations.AnnotationsOperations :ivar api_keys: APIKeysOperations operations - :vartype api_keys: azure.mgmt.applicationinsights.v2015_05_01.operations.APIKeysOperations + :vartype api_keys: azure.mgmt.applicationinsights.operations.APIKeysOperations :ivar export_configurations: ExportConfigurationsOperations operations :vartype export_configurations: - azure.mgmt.applicationinsights.v2015_05_01.operations.ExportConfigurationsOperations + azure.mgmt.applicationinsights.operations.ExportConfigurationsOperations :ivar component_current_billing_features: ComponentCurrentBillingFeaturesOperations operations :vartype component_current_billing_features: - azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentCurrentBillingFeaturesOperations + azure.mgmt.applicationinsights.operations.ComponentCurrentBillingFeaturesOperations :ivar component_quota_status: ComponentQuotaStatusOperations operations :vartype component_quota_status: - azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentQuotaStatusOperations + azure.mgmt.applicationinsights.operations.ComponentQuotaStatusOperations :ivar component_feature_capabilities: ComponentFeatureCapabilitiesOperations operations :vartype component_feature_capabilities: - azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentFeatureCapabilitiesOperations + azure.mgmt.applicationinsights.operations.ComponentFeatureCapabilitiesOperations :ivar component_available_features: ComponentAvailableFeaturesOperations operations :vartype component_available_features: - azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentAvailableFeaturesOperations + azure.mgmt.applicationinsights.operations.ComponentAvailableFeaturesOperations :ivar proactive_detection_configurations: ProactiveDetectionConfigurationsOperations operations :vartype proactive_detection_configurations: - azure.mgmt.applicationinsights.v2015_05_01.operations.ProactiveDetectionConfigurationsOperations - :ivar components: ComponentsOperations operations - :vartype components: azure.mgmt.applicationinsights.v2015_05_01.operations.ComponentsOperations + azure.mgmt.applicationinsights.operations.ProactiveDetectionConfigurationsOperations :ivar work_item_configurations: WorkItemConfigurationsOperations operations :vartype work_item_configurations: - azure.mgmt.applicationinsights.v2015_05_01.operations.WorkItemConfigurationsOperations + azure.mgmt.applicationinsights.operations.WorkItemConfigurationsOperations + :ivar component_linked_storage_accounts: ComponentLinkedStorageAccountsOperations operations + :vartype component_linked_storage_accounts: + azure.mgmt.applicationinsights.operations.ComponentLinkedStorageAccountsOperations + :ivar components: ComponentsOperations operations + :vartype components: azure.mgmt.applicationinsights.operations.ComponentsOperations + :ivar deleted_workbooks: DeletedWorkbooksOperations operations + :vartype deleted_workbooks: + azure.mgmt.applicationinsights.operations.DeletedWorkbooksOperations :ivar favorites: FavoritesOperations operations - :vartype favorites: azure.mgmt.applicationinsights.v2015_05_01.operations.FavoritesOperations - :ivar web_test_locations: WebTestLocationsOperations operations + :vartype favorites: azure.mgmt.applicationinsights.operations.FavoritesOperations + :ivar live_token: LiveTokenOperations operations + :vartype live_token: azure.mgmt.applicationinsights.operations.LiveTokenOperations + :ivar web_test_locations: webTestLocationsOperations operations :vartype web_test_locations: - azure.mgmt.applicationinsights.v2015_05_01.operations.WebTestLocationsOperations - :ivar web_tests: WebTestsOperations operations - :vartype web_tests: azure.mgmt.applicationinsights.v2015_05_01.operations.WebTestsOperations - :ivar analytics_items: AnalyticsItemsOperations operations - :vartype analytics_items: - azure.mgmt.applicationinsights.v2015_05_01.operations.AnalyticsItemsOperations - :ivar workbooks: WorkbooksOperations operations - :vartype workbooks: azure.mgmt.applicationinsights.v2015_05_01.operations.WorkbooksOperations - :ivar my_workbooks: MyWorkbooksOperations operations - :vartype my_workbooks: - azure.mgmt.applicationinsights.v2015_05_01.operations.MyWorkbooksOperations - :param credential: Credential needed for the client to connect to Azure. Required. + azure.mgmt.applicationinsights.operations.webTestLocationsOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2015-05-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( @@ -116,6 +122,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: @@ -124,6 +131,7 @@ def __init__( self._config = ApplicationInsightsManagementClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -147,13 +155,18 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False + self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) + self.workbook_templates = WorkbookTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.analytics_items = AnalyticsItemsOperations(self._client, self._config, self._serialize, self._deserialize) self.annotations = AnnotationsOperations(self._client, self._config, self._serialize, self._deserialize) self.api_keys = APIKeysOperations(self._client, self._config, self._serialize, self._deserialize) self.export_configurations = ExportConfigurationsOperations( @@ -174,26 +187,29 @@ def __init__( self.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.work_item_configurations = WorkItemConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.component_linked_storage_accounts = ComponentLinkedStorageAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_workbooks = DeletedWorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.favorites = FavoritesOperations(self._client, self._config, self._serialize, self._deserialize) - self.web_test_locations = WebTestLocationsOperations( + self.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) + self.web_test_locations = webTestLocationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) - self.analytics_items = AnalyticsItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.my_workbooks = MyWorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = client._send_request(request) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -206,7 +222,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_configuration.py similarity index 86% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_configuration.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_configuration.py index 1881dc428148..3e960988303d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_configuration.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,27 +24,25 @@ class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-m Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-02-02". 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", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2020-02-02") - if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -52,8 +50,8 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting - self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_patch.py index 20806156e442..87676c65a8f0 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_patch.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_patch.py @@ -1,2 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + def patch_sdk(): - pass + """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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/__init__.py similarity index 86% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/__init__.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/__init__.py index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/__init__.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/__init__.py @@ -1,6 +1,6 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/model_base.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/model_base.py new file mode 100644 index 000000000000..7b7f8ba67b53 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/model_base.py @@ -0,0 +1,1350 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null +from azure.core.rest import HttpResponse + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") +_NONE_TYPE = type(None) + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj # type: ignore[no-any-return] + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) # type: ignore[no-any-return] + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value.text if isinstance(value, ET.Element) else value) + except ValueError: + # for unknown value, return raw value + return value.text if isinstance(value, ET.Element) else value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +# pylint: disable=too-many-instance-attributes +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._is_optional = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized + + def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element # type: ignore[no-any-return] + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/serialization.py similarity index 99% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/serialization.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/serialization.py index 6da830e0cf4a..81ec1de5922b 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/serialization.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_version.py index 57e0ad763159..87b557d58cf1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_version.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/_version.py @@ -1 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + VERSION = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/__init__.py similarity index 84% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/__init__.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/__init__.py index 52caca38e9e7..b20073d5852b 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/__init__.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore +from ._client import ApplicationInsightsManagementClient # type: ignore try: from ._patch import __all__ as _patch_all diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_client.py similarity index 68% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_application_insights_management_client.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_client.py index f55abce49908..ea832de666ca 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_application_insights_management_client.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_client.py @@ -1,8 +1,9 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,7 +18,6 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer from ._configuration import ApplicationInsightsManagementClientConfiguration from .operations import ( @@ -27,17 +27,20 @@ ComponentAvailableFeaturesOperations, ComponentCurrentBillingFeaturesOperations, ComponentFeatureCapabilitiesOperations, + ComponentLinkedStorageAccountsOperations, ComponentQuotaStatusOperations, ComponentsOperations, + DeletedWorkbooksOperations, ExportConfigurationsOperations, FavoritesOperations, - MyWorkbooksOperations, + LiveTokenOperations, Operations, ProactiveDetectionConfigurationsOperations, - WebTestLocationsOperations, WebTestsOperations, WorkItemConfigurationsOperations, + WorkbookTemplatesOperations, WorkbooksOperations, + webTestLocationsOperations, ) if TYPE_CHECKING: @@ -45,70 +48,70 @@ from azure.core.credentials_async import AsyncTokenCredential -class ApplicationInsightsManagementClient: # pylint: disable=too-many-instance-attributes - """Composite Swagger for Application Insights Management Client. +class ApplicationInsightsManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes + """ApplicationInsightsManagementClient. + :ivar web_tests: WebTestsOperations operations + :vartype web_tests: azure.mgmt.applicationinsights.aio.operations.WebTestsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.applicationinsights.v2015_05_01.aio.operations.Operations + :vartype operations: azure.mgmt.applicationinsights.aio.operations.Operations + :ivar workbooks: WorkbooksOperations operations + :vartype workbooks: azure.mgmt.applicationinsights.aio.operations.WorkbooksOperations + :ivar workbook_templates: WorkbookTemplatesOperations operations + :vartype workbook_templates: + azure.mgmt.applicationinsights.aio.operations.WorkbookTemplatesOperations + :ivar analytics_items: AnalyticsItemsOperations operations + :vartype analytics_items: + azure.mgmt.applicationinsights.aio.operations.AnalyticsItemsOperations :ivar annotations: AnnotationsOperations operations - :vartype annotations: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.AnnotationsOperations + :vartype annotations: azure.mgmt.applicationinsights.aio.operations.AnnotationsOperations :ivar api_keys: APIKeysOperations operations - :vartype api_keys: azure.mgmt.applicationinsights.v2015_05_01.aio.operations.APIKeysOperations + :vartype api_keys: azure.mgmt.applicationinsights.aio.operations.APIKeysOperations :ivar export_configurations: ExportConfigurationsOperations operations :vartype export_configurations: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ExportConfigurationsOperations + azure.mgmt.applicationinsights.aio.operations.ExportConfigurationsOperations :ivar component_current_billing_features: ComponentCurrentBillingFeaturesOperations operations :vartype component_current_billing_features: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ComponentCurrentBillingFeaturesOperations + azure.mgmt.applicationinsights.aio.operations.ComponentCurrentBillingFeaturesOperations :ivar component_quota_status: ComponentQuotaStatusOperations operations :vartype component_quota_status: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ComponentQuotaStatusOperations + azure.mgmt.applicationinsights.aio.operations.ComponentQuotaStatusOperations :ivar component_feature_capabilities: ComponentFeatureCapabilitiesOperations operations :vartype component_feature_capabilities: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ComponentFeatureCapabilitiesOperations + azure.mgmt.applicationinsights.aio.operations.ComponentFeatureCapabilitiesOperations :ivar component_available_features: ComponentAvailableFeaturesOperations operations :vartype component_available_features: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ComponentAvailableFeaturesOperations + azure.mgmt.applicationinsights.aio.operations.ComponentAvailableFeaturesOperations :ivar proactive_detection_configurations: ProactiveDetectionConfigurationsOperations operations :vartype proactive_detection_configurations: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ProactiveDetectionConfigurationsOperations - :ivar components: ComponentsOperations operations - :vartype components: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.ComponentsOperations + azure.mgmt.applicationinsights.aio.operations.ProactiveDetectionConfigurationsOperations :ivar work_item_configurations: WorkItemConfigurationsOperations operations :vartype work_item_configurations: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.WorkItemConfigurationsOperations + azure.mgmt.applicationinsights.aio.operations.WorkItemConfigurationsOperations + :ivar component_linked_storage_accounts: ComponentLinkedStorageAccountsOperations operations + :vartype component_linked_storage_accounts: + azure.mgmt.applicationinsights.aio.operations.ComponentLinkedStorageAccountsOperations + :ivar components: ComponentsOperations operations + :vartype components: azure.mgmt.applicationinsights.aio.operations.ComponentsOperations + :ivar deleted_workbooks: DeletedWorkbooksOperations operations + :vartype deleted_workbooks: + azure.mgmt.applicationinsights.aio.operations.DeletedWorkbooksOperations :ivar favorites: FavoritesOperations operations - :vartype favorites: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.FavoritesOperations - :ivar web_test_locations: WebTestLocationsOperations operations + :vartype favorites: azure.mgmt.applicationinsights.aio.operations.FavoritesOperations + :ivar live_token: LiveTokenOperations operations + :vartype live_token: azure.mgmt.applicationinsights.aio.operations.LiveTokenOperations + :ivar web_test_locations: webTestLocationsOperations operations :vartype web_test_locations: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.WebTestLocationsOperations - :ivar web_tests: WebTestsOperations operations - :vartype web_tests: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.WebTestsOperations - :ivar analytics_items: AnalyticsItemsOperations operations - :vartype analytics_items: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.AnalyticsItemsOperations - :ivar workbooks: WorkbooksOperations operations - :vartype workbooks: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.WorkbooksOperations - :ivar my_workbooks: MyWorkbooksOperations operations - :vartype my_workbooks: - azure.mgmt.applicationinsights.v2015_05_01.aio.operations.MyWorkbooksOperations - :param credential: Credential needed for the client to connect to Azure. Required. + azure.mgmt.applicationinsights.aio.operations.webTestLocationsOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2015-05-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( @@ -120,6 +123,7 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: @@ -128,6 +132,7 @@ def __init__( self._config = ApplicationInsightsManagementClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -152,14 +157,19 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), policies=_policies, **kwargs ) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False + self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) + self.workbook_templates = WorkbookTemplatesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.analytics_items = AnalyticsItemsOperations(self._client, self._config, self._serialize, self._deserialize) self.annotations = AnnotationsOperations(self._client, self._config, self._serialize, self._deserialize) self.api_keys = APIKeysOperations(self._client, self._config, self._serialize, self._deserialize) self.export_configurations = ExportConfigurationsOperations( @@ -180,20 +190,23 @@ def __init__( self.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) self.work_item_configurations = WorkItemConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.component_linked_storage_accounts = ComponentLinkedStorageAccountsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deleted_workbooks = DeletedWorkbooksOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.favorites = FavoritesOperations(self._client, self._config, self._serialize, self._deserialize) - self.web_test_locations = WebTestLocationsOperations( + self.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) + self.web_test_locations = webTestLocationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) - self.analytics_items = AnalyticsItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.my_workbooks = MyWorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -201,7 +214,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -214,7 +227,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_configuration.py similarity index 86% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_configuration.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_configuration.py index c3d3836541e3..d1b9dc5371bc 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_configuration.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -24,27 +24,25 @@ class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-m Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2015-05-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", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - api_version: str = kwargs.pop("api_version", "2015-05-01") - if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -52,8 +50,8 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting - self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_patch.py similarity index 100% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_patch.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/_patch.py diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/__init__.py new file mode 100644 index 000000000000..6fc765ebbf13 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/__init__.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import WebTestsOperations # type: ignore +from ._operations import Operations # type: ignore +from ._operations import WorkbooksOperations # type: ignore +from ._operations import WorkbookTemplatesOperations # type: ignore +from ._operations import AnalyticsItemsOperations # type: ignore +from ._operations import AnnotationsOperations # type: ignore +from ._operations import APIKeysOperations # type: ignore +from ._operations import ExportConfigurationsOperations # type: ignore +from ._operations import ComponentCurrentBillingFeaturesOperations # type: ignore +from ._operations import ComponentQuotaStatusOperations # type: ignore +from ._operations import ComponentFeatureCapabilitiesOperations # type: ignore +from ._operations import ComponentAvailableFeaturesOperations # type: ignore +from ._operations import ProactiveDetectionConfigurationsOperations # type: ignore +from ._operations import WorkItemConfigurationsOperations # type: ignore +from ._operations import ComponentLinkedStorageAccountsOperations # type: ignore +from ._operations import ComponentsOperations # type: ignore +from ._operations import DeletedWorkbooksOperations # type: ignore +from ._operations import FavoritesOperations # type: ignore +from ._operations import LiveTokenOperations # type: ignore +from ._operations import webTestLocationsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WebTestsOperations", + "Operations", + "WorkbooksOperations", + "WorkbookTemplatesOperations", + "AnalyticsItemsOperations", + "AnnotationsOperations", + "APIKeysOperations", + "ExportConfigurationsOperations", + "ComponentCurrentBillingFeaturesOperations", + "ComponentQuotaStatusOperations", + "ComponentFeatureCapabilitiesOperations", + "ComponentAvailableFeaturesOperations", + "ProactiveDetectionConfigurationsOperations", + "WorkItemConfigurationsOperations", + "ComponentLinkedStorageAccountsOperations", + "ComponentsOperations", + "DeletedWorkbooksOperations", + "FavoritesOperations", + "LiveTokenOperations", + "webTestLocationsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_operations.py new file mode 100644 index 000000000000..aa75727685c2 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_operations.py @@ -0,0 +1,8476 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import ( + build_analytics_items_delete_request, + build_analytics_items_get_request, + build_analytics_items_list_request, + build_analytics_items_put_request, + build_annotations_create_request, + build_annotations_delete_request, + build_annotations_get_request, + build_annotations_list_request, + build_api_keys_create_request, + build_api_keys_delete_request, + build_api_keys_get_request, + build_api_keys_list_request, + build_component_available_features_get_request, + build_component_current_billing_features_get_request, + build_component_current_billing_features_update_request, + build_component_feature_capabilities_get_request, + build_component_linked_storage_accounts_create_and_update_request, + build_component_linked_storage_accounts_delete_request, + build_component_linked_storage_accounts_get_request, + build_component_linked_storage_accounts_update_request, + build_component_quota_status_get_request, + build_components_create_or_update_request, + build_components_delete_request, + build_components_get_purge_status_request, + build_components_get_request, + build_components_list_by_resource_group_request, + build_components_list_request, + build_components_purge_request, + build_components_update_tags_request, + build_deleted_workbooks_list_by_subscription_request, + build_export_configurations_create_request, + build_export_configurations_delete_request, + build_export_configurations_get_request, + build_export_configurations_list_request, + build_export_configurations_update_request, + build_favorites_add_request, + build_favorites_delete_request, + build_favorites_get_request, + build_favorites_list_request, + build_favorites_update_request, + build_live_token_get_request, + build_operations_list_request, + build_proactive_detection_configurations_get_request, + build_proactive_detection_configurations_list_request, + build_proactive_detection_configurations_update_request, + build_web_test_locations_list_request, + build_web_tests_create_or_update_request, + build_web_tests_delete_request, + build_web_tests_get_request, + build_web_tests_list_by_component_request, + build_web_tests_list_by_resource_group_request, + build_web_tests_list_request, + build_web_tests_update_tags_request, + build_work_item_configurations_create_request, + build_work_item_configurations_delete_request, + build_work_item_configurations_get_default_request, + build_work_item_configurations_get_item_request, + build_work_item_configurations_list_request, + build_work_item_configurations_update_item_request, + build_workbook_templates_create_or_update_request, + build_workbook_templates_delete_request, + build_workbook_templates_get_request, + build_workbook_templates_list_by_resource_group_request, + build_workbook_templates_update_request, + build_workbooks_create_or_update_request, + build_workbooks_delete_request, + build_workbooks_get_request, + build_workbooks_list_by_resource_group_request, + build_workbooks_list_by_subscription_request, + build_workbooks_revision_get_request, + build_workbooks_revisions_list_request, + build_workbooks_update_request, +) +from .._configuration import ApplicationInsightsManagementClientConfiguration + +JSON = MutableMapping[str, Any] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list + + +class WebTestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`web_tests` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: + """Get a specific Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + _request = build_web_tests_get_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WebTest, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: _models.WebTest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.models.WebTest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: Union[_models.WebTest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Is one of the following types: WebTest, JSON, + IO[bytes] Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.models.WebTest or JSON or IO[bytes] + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(web_test_definition, (IOBase, bytes)): + _content = web_test_definition + else: + _content = json.dumps(web_test_definition, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_web_tests_create_or_update_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WebTest, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: _models.WebTestTagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Updates the tags associated with an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to associate with the web test resource. + Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.models.WebTestTagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Updates the tags associated with an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to associate with the web test resource. + Required. + :type web_test_tags: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Updates the tags associated with an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to associate with the web test resource. + Required. + :type web_test_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: Union[_models.WebTestTagsResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Updates the tags associated with an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to associate with the web test resource. Is one + of the following types: WebTestTagsResource, JSON, IO[bytes] Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.models.WebTestTagsResource or JSON or + IO[bytes] + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(web_test_tags, (IOBase, bytes)): + _content = web_test_tags + else: + _content = json.dumps(web_test_tags, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_web_tests_update_tags_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WebTest, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> None: + """Deletes an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_web_tests_delete_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined for the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of WebTest + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :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", "2022-06-15")) + cls: ClsType[List[_models.WebTest]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_web_tests_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.WebTest], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: + """Get all Application Insights web test definitions for the specified subscription. + + :return: An iterator like instance of WebTest + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :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", "2022-06-15")) + cls: ClsType[List[_models.WebTest]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_web_tests_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.WebTest], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_component( + self, resource_group_name: str, component_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined for the specified component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param component_name: The name of the Application Insights component resource. Required. + :type component_name: str + :return: An iterator like instance of WebTest + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :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", "2022-06-15")) + cls: ClsType[List[_models.WebTest]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_web_tests_list_by_component_request( + resource_group_name=resource_group_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.WebTest], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class WorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`workbooks` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, *, can_fetch_content: Optional[bool] = None, **kwargs: Any + ) -> _models.Workbook: + """Get a single workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :keyword can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :paramtype can_fetch_content: bool + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_workbooks_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workbook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.Workbook, + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.models.Workbook + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: JSON, + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: JSON + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: IO[bytes] + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.Workbook, JSON, IO[bytes]], + *, + source_id: Optional[str] = None, + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. Is + one of the following types: Workbook, JSON, IO[bytes] Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.models.Workbook or JSON or IO[bytes] + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _content = json.dumps(workbook_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_workbooks_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workbook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.models.WorkbookUpdateParameters + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_update_parameters: Optional[JSON] = None, + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: JSON + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_update_parameters: Optional[IO[bytes]] = None, + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: IO[bytes] + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, JSON, IO[bytes]]] = None, + *, + source_id: Optional[str] = None, + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Is one of the following types: WorkbookUpdateParameters, JSON, IO[bytes] Default + value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.models.WorkbookUpdateParameters or JSON or IO[bytes] + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_update_parameters else None + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if workbook_update_parameters else None + _content = None + if isinstance(workbook_update_parameters, (IOBase, bytes)): + _content = workbook_update_parameters + else: + if workbook_update_parameters is not None: + _content = json.dumps(workbook_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_workbooks_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workbook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Delete a workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_workbooks_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_subscription( + self, + *, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified subscription and category. + + :keyword category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :paramtype category: str or ~azure.mgmt.applicationinsights.models.CategoryType + :keyword tags: Tags presents on each workbook returned. Default value is None. + :paramtype tags: list[str] + :keyword can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :paramtype can_fetch_content: bool + :return: An iterator like instance of Workbook + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + :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", "2023-06-01")) + cls: ClsType[List[_models.Workbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_workbooks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Workbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def revisions_list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Workbook"]: + """Get the revisions for the workbook defined by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :return: An iterator like instance of Workbook + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + :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", "2023-06-01")) + cls: ClsType[List[_models.Workbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_workbooks_revisions_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Workbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def revision_get( + self, resource_group_name: str, resource_name: str, revision_id: str, **kwargs: Any + ) -> _models.Workbook: + """Get a single workbook revision defined by its revisionId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param revision_id: The id of the workbook's revision. Required. + :type revision_id: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_workbooks_revision_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + revision_id=revision_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workbook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + source_id: Optional[str] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :paramtype category: str or ~azure.mgmt.applicationinsights.models.CategoryType + :keyword tags: Tags presents on each workbook returned. Default value is None. + :paramtype tags: list[str] + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :paramtype can_fetch_content: bool + :return: An iterator like instance of Workbook + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + :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", "2023-06-01")) + cls: ClsType[List[_models.Workbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_workbooks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + source_id=source_id, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Workbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class WorkbookTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`workbook_templates` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.WorkbookTemplate: + """Get a single workbook template by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + _request = build_workbook_templates_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookTemplateError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkbookTemplate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: _models.WorkbookTemplate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Required. + :type workbook_template_properties: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Required. + :type workbook_template_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Required. + :type workbook_template_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: Union[_models.WorkbookTemplate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Is one of the following types: WorkbookTemplate, JSON, IO[bytes] Required. + :type workbook_template_properties: ~azure.mgmt.applicationinsights.models.WorkbookTemplate or + JSON or IO[bytes] + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(workbook_template_properties, (IOBase, bytes)): + _content = workbook_template_properties + else: + _content = json.dumps(workbook_template_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_workbook_templates_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookTemplateError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkbookTemplate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[_models.WorkbookTemplateUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Default value is None. + :type workbook_template_update_parameters: + ~azure.mgmt.applicationinsights.models.WorkbookTemplateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Default value is None. + :type workbook_template_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Default value is None. + :type workbook_template_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[ + Union[_models.WorkbookTemplateUpdateParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Is one of the following types: WorkbookTemplateUpdateParameters, JSON, + IO[bytes] Default value is None. + :type workbook_template_update_parameters: + ~azure.mgmt.applicationinsights.models.WorkbookTemplateUpdateParameters or JSON or IO[bytes] + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_template_update_parameters else None + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if workbook_template_update_parameters else None + _content = None + if isinstance(workbook_template_update_parameters, (IOBase, bytes)): + _content = workbook_template_update_parameters + else: + if workbook_template_update_parameters is not None: + _content = json.dumps(workbook_template_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_workbook_templates_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookTemplateError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkbookTemplate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Delete a workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_workbook_templates_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookTemplateError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.WorkbookTemplate"]: + """Get all Workbook templates defined within a specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of WorkbookTemplate + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.WorkbookTemplate] + :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", "2020-11-20")) + cls: ClsType[List[_models.WorkbookTemplate]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_workbook_templates_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.WorkbookTemplate], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookTemplateError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class AnalyticsItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`analytics_items` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + *, + scope: Optional[Union[str, _models.ItemScope]] = None, + type: Optional[Union[str, _models.ItemTypeParameter]] = None, + include_content: Optional[bool] = None, + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentAnalyticsItem]: + """Gets a list of Analytics Items defined within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :keyword scope: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "shared" and "user". Default value is None. + :paramtype scope: str or ~azure.mgmt.applicationinsights.models.ItemScope + :keyword type: Enum indicating the type of the Analytics item. Known values are: "none", + "query", "function", "folder", and "recent". Default value is None. + :paramtype type: str or ~azure.mgmt.applicationinsights.models.ItemTypeParameter + :keyword include_content: Flag indicating whether or not to return the content of each + applicable item. If false, only return the item information. Default value is None. + :paramtype include_content: bool + :return: list of ApplicationInsightsComponentAnalyticsItem + :rtype: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentAnalyticsItem]] = kwargs.pop("cls", None) + + _request = build_analytics_items_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + scope_path=scope_path, + subscription_id=self._config.subscription_id, + scope=scope, + type=type, + include_content=include_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.ApplicationInsightsComponentAnalyticsItem], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + *, + id: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAnalyticsItem: + """Gets a specific Analytics Items defined within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :keyword id: The Id of a specific item defined in the Application Insights component. Default + value is None. + :paramtype id: str + :keyword name: The name of a specific item defined in the Application Insights component. + Default value is None. + :paramtype name: str + :return: ApplicationInsightsComponentAnalyticsItem. The + ApplicationInsightsComponentAnalyticsItem is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) + + _request = build_analytics_items_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + scope_path=scope_path, + subscription_id=self._config.subscription_id, + id=id, + name=name, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAnalyticsItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def put( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + item_properties: _models.ApplicationInsightsComponentAnalyticsItem, + *, + override_item: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAnalyticsItem: + """Adds or Updates a specific Analytics Item within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :param item_properties: Properties that need to be specified to create a new item and add it to + an Application Insights component. Required. + :type item_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :keyword override_item: Flag indicating whether or not to force save an item. This allows + overriding an item if it already exists. Default value is None. + :paramtype override_item: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAnalyticsItem. The + ApplicationInsightsComponentAnalyticsItem is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + item_properties: JSON, + *, + override_item: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAnalyticsItem: + """Adds or Updates a specific Analytics Item within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :param item_properties: Properties that need to be specified to create a new item and add it to + an Application Insights component. Required. + :type item_properties: JSON + :keyword override_item: Flag indicating whether or not to force save an item. This allows + overriding an item if it already exists. Default value is None. + :paramtype override_item: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAnalyticsItem. The + ApplicationInsightsComponentAnalyticsItem is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def put( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + item_properties: IO[bytes], + *, + override_item: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAnalyticsItem: + """Adds or Updates a specific Analytics Item within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :param item_properties: Properties that need to be specified to create a new item and add it to + an Application Insights component. Required. + :type item_properties: IO[bytes] + :keyword override_item: Flag indicating whether or not to force save an item. This allows + overriding an item if it already exists. Default value is None. + :paramtype override_item: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAnalyticsItem. The + ApplicationInsightsComponentAnalyticsItem is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def put( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + item_properties: Union[_models.ApplicationInsightsComponentAnalyticsItem, JSON, IO[bytes]], + *, + override_item: Optional[bool] = None, + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAnalyticsItem: + """Adds or Updates a specific Analytics Item within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :param item_properties: Properties that need to be specified to create a new item and add it to + an Application Insights component. Is one of the following types: + ApplicationInsightsComponentAnalyticsItem, JSON, IO[bytes] Required. + :type item_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem or JSON or + IO[bytes] + :keyword override_item: Flag indicating whether or not to force save an item. This allows + overriding an item if it already exists. Default value is None. + :paramtype override_item: bool + :return: ApplicationInsightsComponentAnalyticsItem. The + ApplicationInsightsComponentAnalyticsItem is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(item_properties, (IOBase, bytes)): + _content = item_properties + else: + _content = json.dumps(item_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_analytics_items_put_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + scope_path=scope_path, + subscription_id=self._config.subscription_id, + override_item=override_item, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAnalyticsItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + *, + id: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """Deletes a specific Analytics Items defined within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :keyword id: The Id of a specific item defined in the Application Insights component. Default + value is None. + :paramtype id: str + :keyword name: The name of a specific item defined in the Application Insights component. + Default value is None. + :paramtype name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_analytics_items_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + scope_path=scope_path, + subscription_id=self._config.subscription_id, + id=id, + name=name, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class AnnotationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`annotations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, *, start: str, end: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Annotation"]: + """Gets the list of annotations for a component for given time range. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :keyword start: The start time to query from for annotations, cannot be older than 90 days from + current date. Required. + :paramtype start: str + :keyword end: The end time to query for annotations. Required. + :paramtype end: str + :return: An iterator like instance of Annotation + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.Annotation] + :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", "2015-05-01")) + cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_annotations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + start=start, + end=end, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Annotation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.AnnotationError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + annotation_properties: _models.Annotation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.Annotation]: + """Create an Annotation of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_properties: Properties that need to be specified to create an annotation of a + Application Insights component. Required. + :type annotation_properties: ~azure.mgmt.applicationinsights.models.Annotation + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of Annotation + :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + annotation_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.Annotation]: + """Create an Annotation of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_properties: Properties that need to be specified to create an annotation of a + Application Insights component. Required. + :type annotation_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of Annotation + :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + annotation_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.Annotation]: + """Create an Annotation of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_properties: Properties that need to be specified to create an annotation of a + Application Insights component. Required. + :type annotation_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: list of Annotation + :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + annotation_properties: Union[_models.Annotation, JSON, IO[bytes]], + **kwargs: Any + ) -> List[_models.Annotation]: + """Create an Annotation of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_properties: Properties that need to be specified to create an annotation of a + Application Insights component. Is one of the following types: Annotation, JSON, IO[bytes] + Required. + :type annotation_properties: ~azure.mgmt.applicationinsights.models.Annotation or JSON or + IO[bytes] + :return: list of Annotation + :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(annotation_properties, (IOBase, bytes)): + _content = annotation_properties + else: + _content = json.dumps(annotation_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_annotations_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.AnnotationError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.Annotation], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, annotation_id: str, **kwargs: Any) -> None: + """Delete an Annotation of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_id: The unique annotation ID. This is unique within a Application Insights + component. Required. + :type annotation_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_annotations_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + annotation_id=annotation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, annotation_id: str, **kwargs: Any + ) -> List[_models.Annotation]: + """Get the annotation for given id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_id: The unique annotation ID. This is unique within a Application Insights + component. Required. + :type annotation_id: str + :return: list of Annotation + :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) + + _request = build_annotations_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + annotation_id=annotation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.AnnotationError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.Annotation], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class APIKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`api_keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ApplicationInsightsComponentAPIKey"]: + """Gets a list of API keys of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: An iterator like instance of ApplicationInsightsComponentAPIKey + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey] + :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", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentAPIKey]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_api_keys_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ApplicationInsightsComponentAPIKey], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + api_key_properties: _models.APIKeyRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Create an API Key of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param api_key_properties: Properties that need to be specified to create an API Key of an + Application Insights component. Required. + :type api_key_properties: ~azure.mgmt.applicationinsights.models.APIKeyRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + api_key_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Create an API Key of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param api_key_properties: Properties that need to be specified to create an API Key of an + Application Insights component. Required. + :type api_key_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + api_key_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Create an API Key of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param api_key_properties: Properties that need to be specified to create an API Key of an + Application Insights component. Required. + :type api_key_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + api_key_properties: Union[_models.APIKeyRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Create an API Key of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param api_key_properties: Properties that need to be specified to create an API Key of an + Application Insights component. Is one of the following types: APIKeyRequest, JSON, IO[bytes] + Required. + :type api_key_properties: ~azure.mgmt.applicationinsights.models.APIKeyRequest or JSON or + IO[bytes] + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(api_key_properties, (IOBase, bytes)): + _content = api_key_properties + else: + _content = json.dumps(api_key_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_api_keys_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAPIKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, resource_name: str, key_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Delete an API Key of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param key_id: The API Key ID. This is unique within a Application Insights component. + Required. + :type key_id: str + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) + + _request = build_api_keys_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + key_id=key_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAPIKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, key_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Get the API Key for this key id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param key_id: The API Key ID. This is unique within a Application Insights component. + Required. + :type key_id: str + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) + + _request = build_api_keys_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + key_id=key_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAPIKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ExportConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`export_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: + """Gets a list of Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: list of ApplicationInsightsComponentExportConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) + + _request = build_export_configurations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.ApplicationInsightsComponentExportConfiguration], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + export_properties: _models.ApplicationInsightsComponentExportRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: + """Create a Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_properties: The request body. Required. + :type export_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of ApplicationInsightsComponentExportConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + export_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: + """Create a Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_properties: The request body. Required. + :type export_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of ApplicationInsightsComponentExportConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + export_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: + """Create a Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_properties: The request body. Required. + :type export_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: list of ApplicationInsightsComponentExportConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + export_properties: Union[_models.ApplicationInsightsComponentExportRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: + """Create a Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_properties: The request body. Is one of the following types: + ApplicationInsightsComponentExportRequest, JSON, IO[bytes] Required. + :type export_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest or JSON or + IO[bytes] + :return: list of ApplicationInsightsComponentExportConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(export_properties, (IOBase, bytes)): + _content = export_properties + else: + _content = json.dumps(export_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_export_configurations_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.ApplicationInsightsComponentExportConfiguration], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, resource_name: str, export_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Delete a Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) + + _request = build_export_configurations_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + export_id=export_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentExportConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, export_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Get the Continuous Export configuration for this export id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) + + _request = build_export_configurations_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + export_id=export_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentExportConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + export_id: str, + export_properties: _models.ApplicationInsightsComponentExportRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Update the Continuous Export configuration for this export id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :param export_properties: Properties that need to be specified to update the Continuous Export + configuration. Required. + :type export_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + export_id: str, + export_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Update the Continuous Export configuration for this export id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :param export_properties: Properties that need to be specified to update the Continuous Export + configuration. Required. + :type export_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + export_id: str, + export_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Update the Continuous Export configuration for this export id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :param export_properties: Properties that need to be specified to update the Continuous Export + configuration. Required. + :type export_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + export_id: str, + export_properties: Union[_models.ApplicationInsightsComponentExportRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Update the Continuous Export configuration for this export id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :param export_properties: Properties that need to be specified to update the Continuous Export + configuration. Is one of the following types: ApplicationInsightsComponentExportRequest, JSON, + IO[bytes] Required. + :type export_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest or JSON or + IO[bytes] + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(export_properties, (IOBase, bytes)): + _content = export_properties + else: + _content = json.dumps(export_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_export_configurations_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + export_id=export_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentExportConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ComponentCurrentBillingFeaturesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`component_current_billing_features` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentBillingFeatures: + """Returns current billing features for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponentBillingFeatures. The + ApplicationInsightsComponentBillingFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) + + _request = build_component_current_billing_features_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentBillingFeatures, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + billing_features_properties: _models.ApplicationInsightsComponentBillingFeatures, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentBillingFeatures: + """Update current billing features for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param billing_features_properties: The request body. Required. + :type billing_features_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentBillingFeatures. The + ApplicationInsightsComponentBillingFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + billing_features_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentBillingFeatures: + """Update current billing features for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param billing_features_properties: The request body. Required. + :type billing_features_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentBillingFeatures. The + ApplicationInsightsComponentBillingFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + billing_features_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentBillingFeatures: + """Update current billing features for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param billing_features_properties: The request body. Required. + :type billing_features_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentBillingFeatures. The + ApplicationInsightsComponentBillingFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + billing_features_properties: Union[_models.ApplicationInsightsComponentBillingFeatures, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentBillingFeatures: + """Update current billing features for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param billing_features_properties: The request body. Is one of the following types: + ApplicationInsightsComponentBillingFeatures, JSON, IO[bytes] Required. + :type billing_features_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures or JSON or + IO[bytes] + :return: ApplicationInsightsComponentBillingFeatures. The + ApplicationInsightsComponentBillingFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(billing_features_properties, (IOBase, bytes)): + _content = billing_features_properties + else: + _content = json.dumps(billing_features_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_component_current_billing_features_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentBillingFeatures, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ComponentQuotaStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`component_quota_status` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentQuotaStatus: + """Returns daily data volume cap (quota) status for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponentQuotaStatus. The ApplicationInsightsComponentQuotaStatus + is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentQuotaStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentQuotaStatus] = kwargs.pop("cls", None) + + _request = build_component_quota_status_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentQuotaStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ComponentFeatureCapabilitiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`component_feature_capabilities` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentFeatureCapabilities: + """Returns feature capabilities of the application insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponentFeatureCapabilities. The + ApplicationInsightsComponentFeatureCapabilities is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeatureCapabilities + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentFeatureCapabilities] = kwargs.pop("cls", None) + + _request = build_component_feature_capabilities_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentFeatureCapabilities, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ComponentAvailableFeaturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`component_available_features` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentAvailableFeatures: + """Returns all available features of the application insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponentAvailableFeatures. The + ApplicationInsightsComponentAvailableFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAvailableFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentAvailableFeatures] = kwargs.pop("cls", None) + + _request = build_component_available_features_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAvailableFeatures, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`proactive_detection_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]: + """Gets a list of ProactiveDetection configurations of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: list of ApplicationInsightsComponentProactiveDetectionConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( + "cls", None + ) + + _request = build_proactive_detection_configurations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize( + List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration], response.json() + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, configuration_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Get the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration. The + ApplicationInsightsComponentProactiveDetectionConfiguration is compatible with MutableMapping + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) + + _request = build_proactive_detection_configurations_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + configuration_id=configuration_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize( + _models.ApplicationInsightsComponentProactiveDetectionConfiguration, response.json() + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: _models.ApplicationInsightsComponentProactiveDetectionConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Required. + :type proactive_detection_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration. The + ApplicationInsightsComponentProactiveDetectionConfiguration is compatible with MutableMapping + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Required. + :type proactive_detection_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration. The + ApplicationInsightsComponentProactiveDetectionConfiguration is compatible with MutableMapping + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Required. + :type proactive_detection_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration. The + ApplicationInsightsComponentProactiveDetectionConfiguration is compatible with MutableMapping + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: Union[ + _models.ApplicationInsightsComponentProactiveDetectionConfiguration, JSON, IO[bytes] + ], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Is one of the following types: + ApplicationInsightsComponentProactiveDetectionConfiguration, JSON, IO[bytes] Required. + :type proactive_detection_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + or JSON or IO[bytes] + :return: ApplicationInsightsComponentProactiveDetectionConfiguration. The + ApplicationInsightsComponentProactiveDetectionConfiguration is compatible with MutableMapping + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(proactive_detection_properties, (IOBase, bytes)): + _content = proactive_detection_properties + else: + _content = json.dumps(proactive_detection_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_proactive_detection_configurations_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + configuration_id=configuration_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize( + _models.ApplicationInsightsComponentProactiveDetectionConfiguration, response.json() + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class WorkItemConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`work_item_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.WorkItemConfiguration"]: + """Gets the list work item configurations that exist for the application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: An iterator like instance of WorkItemConfiguration + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.WorkItemConfiguration] + :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", "2015-05-01")) + cls: ClsType[List[_models.WorkItemConfiguration]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_work_item_configurations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.WorkItemConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkItemConfigurationError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + work_item_configuration_properties: _models.WorkItemCreateConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Create a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_configuration_properties: Work item configuration creation payload. Required. + :type work_item_configuration_properties: + ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + work_item_configuration_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Create a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_configuration_properties: Work item configuration creation payload. Required. + :type work_item_configuration_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + resource_name: str, + work_item_configuration_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Create a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_configuration_properties: Work item configuration creation payload. Required. + :type work_item_configuration_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + resource_name: str, + work_item_configuration_properties: Union[_models.WorkItemCreateConfiguration, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Create a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_configuration_properties: Work item configuration creation payload. Is one of + the following types: WorkItemCreateConfiguration, JSON, IO[bytes] Required. + :type work_item_configuration_properties: + ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration or JSON or IO[bytes] + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(work_item_configuration_properties, (IOBase, bytes)): + _content = work_item_configuration_properties + else: + _content = json.dumps(work_item_configuration_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_work_item_configurations_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkItemConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_default( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Gets default work item configurations that exist for the application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) + + _request = build_work_item_configurations_get_default_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkItemConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, resource_name: str, work_item_config_id: str, **kwargs: Any + ) -> None: + """Delete a work item configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_work_item_configurations_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + work_item_config_id=work_item_config_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get_item( + self, resource_group_name: str, resource_name: str, work_item_config_id: str, **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Gets specified work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) + + _request = build_work_item_configurations_get_item_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + work_item_config_id=work_item_config_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkItemConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_item( + self, + resource_group_name: str, + resource_name: str, + work_item_config_id: str, + work_item_configuration_properties: _models.WorkItemCreateConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Update a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :param work_item_configuration_properties: Properties that need to be specified to update a + work item configuration for this Application Insights component. Required. + :type work_item_configuration_properties: + ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_item( + self, + resource_group_name: str, + resource_name: str, + work_item_config_id: str, + work_item_configuration_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Update a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :param work_item_configuration_properties: Properties that need to be specified to update a + work item configuration for this Application Insights component. Required. + :type work_item_configuration_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_item( + self, + resource_group_name: str, + resource_name: str, + work_item_config_id: str, + work_item_configuration_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Update a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :param work_item_configuration_properties: Properties that need to be specified to update a + work item configuration for this Application Insights component. Required. + :type work_item_configuration_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_item( + self, + resource_group_name: str, + resource_name: str, + work_item_config_id: str, + work_item_configuration_properties: Union[_models.WorkItemCreateConfiguration, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Update a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :param work_item_configuration_properties: Properties that need to be specified to update a + work item configuration for this Application Insights component. Is one of the following types: + WorkItemCreateConfiguration, JSON, IO[bytes] Required. + :type work_item_configuration_properties: + ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration or JSON or IO[bytes] + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(work_item_configuration_properties, (IOBase, bytes)): + _content = work_item_configuration_properties + else: + _content = json.dumps(work_item_configuration_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_work_item_configurations_update_item_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + work_item_config_id=work_item_config_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkItemConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ComponentLinkedStorageAccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`component_linked_storage_accounts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, storage_type: Union[str, _models.StorageType], **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Returns the current linked storage settings for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) + + _request = build_component_linked_storage_accounts_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + storage_type=storage_type, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComponentLinkedStorageAccounts, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_and_update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: _models.ComponentLinkedStorageAccounts, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Replace current linked storage account for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: + ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_and_update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Replace current linked storage account for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_and_update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Replace current linked storage account for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_and_update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: Union[_models.ComponentLinkedStorageAccounts, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Replace current linked storage account for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update + linked storage accounts for an Application Insights component. Is one of the following types: + ComponentLinkedStorageAccounts, JSON, IO[bytes] Required. + :type linked_storage_accounts_properties: + ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts or JSON or IO[bytes] + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): + _content = linked_storage_accounts_properties + else: + _content = json.dumps(linked_storage_accounts_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_component_linked_storage_accounts_create_and_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + storage_type=storage_type, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComponentLinkedStorageAccounts, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: _models.ComponentLinkedStorageAccountsPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Update linked storage accounts for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update a + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: + ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccountsPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Update linked storage accounts for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update a + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Update linked storage accounts for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update a + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: Union[_models.ComponentLinkedStorageAccountsPatch, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Update linked storage accounts for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update a + linked storage accounts for an Application Insights component. Is one of the following types: + ComponentLinkedStorageAccountsPatch, JSON, IO[bytes] Required. + :type linked_storage_accounts_properties: + ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccountsPatch or JSON or IO[bytes] + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): + _content = linked_storage_accounts_properties + else: + _content = json.dumps(linked_storage_accounts_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_component_linked_storage_accounts_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + storage_type=storage_type, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComponentLinkedStorageAccounts, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, resource_name: str, storage_type: Union[str, _models.StorageType], **kwargs: Any + ) -> None: + """Delete linked storage accounts for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_component_linked_storage_accounts_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + storage_type=storage_type, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class ComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`components` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Returns an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + _request = build_components_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: _models.ApplicationInsightsComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: Union[_models.ApplicationInsightsComponent, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Is one of the following types: ApplicationInsightsComponent, JSON, + IO[bytes] Required. + :type insight_properties: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + or JSON or IO[bytes] + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(insight_properties, (IOBase, bytes)): + _content = insight_properties + else: + _content = json.dumps(insight_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_components_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: ~azure.mgmt.applicationinsights.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: Union[_models.TagsResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Is one of + the following types: TagsResource, JSON, IO[bytes] Required. + :type component_tags: ~azure.mgmt.applicationinsights.models.TagsResource or JSON or IO[bytes] + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(component_tags, (IOBase, bytes)): + _content = component_tags + else: + _content = json.dumps(component_tags, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_components_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: + """Deletes an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_components_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of Application Insights components within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of ApplicationInsightsComponent + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent] + :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", "2020-02-02")) + cls: ClsType[List[_models.ApplicationInsightsComponent]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_components_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ApplicationInsightsComponent], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of all Application Insights components within a subscription. + + :return: An iterator like instance of ApplicationInsightsComponent + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent] + :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", "2020-02-02")) + cls: ClsType[List[_models.ApplicationInsightsComponent]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_components_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ApplicationInsightsComponent], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: _models.ComponentPurgeBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(`https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge + `_) , scoped to + specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: ~azure.mgmt.applicationinsights.models.ComponentPurgeBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse. The ComponentPurgeResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(`https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge + `_) , scoped to + specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse. The ComponentPurgeResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(`https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge + `_) , scoped to + specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse. The ComponentPurgeResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def purge( + self, + resource_group_name: str, + resource_name: str, + body: Union[_models.ComponentPurgeBody, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(`https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge + `_) , scoped to + specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Is one of the following types: ComponentPurgeBody, JSON, IO[bytes] + Required. + :type body: ~azure.mgmt.applicationinsights.models.ComponentPurgeBody or JSON or IO[bytes] + :return: ComponentPurgeResponse. The ComponentPurgeResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_components_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComponentPurgeResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_purge_status( + self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any + ) -> _models.ComponentPurgeStatusResponse: + """Get status for an ongoing purge operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param purge_id: In a purge status request, this is the Id of the operation the status of which + is returned. Required. + :type purge_id: str + :return: ComponentPurgeStatusResponse. The ComponentPurgeStatusResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) + + _request = build_components_get_purge_status_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + purge_id=purge_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComponentPurgeStatusResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DeletedWorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`deleted_workbooks` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription( + self, + *, + category: Optional[Union[str, _models.DeletedWorkbookCategoryType]] = None, + tags: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncItemPaged["_models.DeletedWorkbook"]: + """Get all recently deleted Workbooks in a specified subscription. + + :keyword category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Default value is None. + :paramtype category: str or ~azure.mgmt.applicationinsights.models.DeletedWorkbookCategoryType + :keyword tags: Tags presents on each workbook returned. Default value is None. + :paramtype tags: list[str] + :return: An iterator like instance of DeletedWorkbook + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.DeletedWorkbook] + :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", "2024-02-01-preview")) + cls: ClsType[List[_models.DeletedWorkbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deleted_workbooks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DeletedWorkbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.DeletedWorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class FavoritesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`favorites` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + resource_name: str, + *, + favorite_type: Optional[Union[str, _models.FavoriteType]] = None, + source_type: Optional[Union[str, _models.FavoriteSourceType]] = None, + can_fetch_content: Optional[bool] = None, + tags: Optional[List[str]] = None, + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentFavorite]: + """Gets a list of favorites defined within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :keyword favorite_type: The type of favorite. Value can be either shared or user. Known values + are: "shared" and "user". Default value is None. + :paramtype favorite_type: str or ~azure.mgmt.applicationinsights.models.FavoriteType + :keyword source_type: Source type of favorite to return. When left out, the source type + defaults to 'other' (not present in this enum). Known values are: "retention", "notebook", + "sessions", "events", "userflows", "funnel", "impact", and "segmentation". Default value is + None. + :paramtype source_type: str or ~azure.mgmt.applicationinsights.models.FavoriteSourceType + :keyword can_fetch_content: Flag indicating whether or not to return the full content for each + applicable favorite. If false, only return summary content for favorites. Default value is + None. + :paramtype can_fetch_content: bool + :keyword tags: Tags that must be present on each favorite returned. Default value is None. + :paramtype tags: list[str] + :return: list of ApplicationInsightsComponentFavorite + :rtype: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentFavorite]] = kwargs.pop("cls", None) + + _request = build_favorites_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + favorite_type=favorite_type, + source_type=source_type, + can_fetch_content=can_fetch_content, + tags=tags, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.ApplicationInsightsComponentFavorite], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, favorite_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Get a single favorite by its FavoriteId, defined within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) + + _request = build_favorites_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + favorite_id=favorite_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentFavorite, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def add( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: _models.ApplicationInsightsComponentFavorite, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Adds a new favorites to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to create a new favorite and + add it to an Application Insights component. Required. + :type favorite_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def add( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Adds a new favorites to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to create a new favorite and + add it to an Application Insights component. Required. + :type favorite_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def add( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Adds a new favorites to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to create a new favorite and + add it to an Application Insights component. Required. + :type favorite_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def add( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: Union[_models.ApplicationInsightsComponentFavorite, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Adds a new favorites to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to create a new favorite and + add it to an Application Insights component. Is one of the following types: + ApplicationInsightsComponentFavorite, JSON, IO[bytes] Required. + :type favorite_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite or JSON or + IO[bytes] + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(favorite_properties, (IOBase, bytes)): + _content = favorite_properties + else: + _content = json.dumps(favorite_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_favorites_add_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + favorite_id=favorite_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentFavorite, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: _models.ApplicationInsightsComponentFavorite, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Updates a favorite that has already been added to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to update the existing + favorite. Required. + :type favorite_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Updates a favorite that has already been added to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to update the existing + favorite. Required. + :type favorite_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Updates a favorite that has already been added to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to update the existing + favorite. Required. + :type favorite_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: Union[_models.ApplicationInsightsComponentFavorite, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Updates a favorite that has already been added to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to update the existing + favorite. Is one of the following types: ApplicationInsightsComponentFavorite, JSON, IO[bytes] + Required. + :type favorite_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite or JSON or + IO[bytes] + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(favorite_properties, (IOBase, bytes)): + _content = favorite_properties + else: + _content = json.dumps(favorite_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_favorites_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + favorite_id=favorite_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentFavorite, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, resource_name: str, favorite_id: str, **kwargs: Any) -> None: + """Remove a favorite that is associated to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_favorites_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + favorite_id=favorite_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class LiveTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`live_token` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: + """**Gets an access token for live metrics stream data.**. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :return: LiveTokenResponse. The LiveTokenResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.LiveTokenResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-10-14")) + cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) + + _request = build_live_token_get_request( + resource_uri=resource_uri, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.LiveTokenErrorResponseLinkedStorage, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LiveTokenResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class webTestLocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.aio.ApplicationInsightsManagementClient`'s + :attr:`web_test_locations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ApplicationInsightsComponentWebTestLocation"]: + """Gets a list of web test locations available to this Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: An iterator like instance of ApplicationInsightsComponentWebTestLocation + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentWebTestLocation] + :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", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentWebTestLocation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_web_test_locations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ApplicationInsightsComponentWebTestLocation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_patch.py similarity index 100% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/_patch.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/aio/operations/_patch.py diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py similarity index 55% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/__init__.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py index e51fb7fa8416..0f5750113af5 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/__init__.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,14 +13,12 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore APIKeyRequest, Annotation, AnnotationError, - AnnotationsListResult, ApplicationInsightsComponent, ApplicationInsightsComponentAPIKey, - ApplicationInsightsComponentAPIKeyListResult, ApplicationInsightsComponentAnalyticsItem, ApplicationInsightsComponentAnalyticsItemProperties, ApplicationInsightsComponentAvailableFeatures, @@ -32,48 +30,82 @@ ApplicationInsightsComponentFeature, ApplicationInsightsComponentFeatureCapabilities, ApplicationInsightsComponentFeatureCapability, - ApplicationInsightsComponentListResult, ApplicationInsightsComponentProactiveDetectionConfiguration, ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions, + ApplicationInsightsComponentProperties, ApplicationInsightsComponentQuotaStatus, ApplicationInsightsComponentWebTestLocation, - ApplicationInsightsWebTestLocationsListResult, + ComponentLinkedStorageAccounts, + ComponentLinkedStorageAccountsPatch, ComponentPurgeBody, ComponentPurgeBodyFilters, ComponentPurgeResponse, ComponentPurgeStatusResponse, ComponentsResource, + DeletedWorkbook, + DeletedWorkbookError, + DeletedWorkbookErrorDefinition, + DeletedWorkbookInnerErrorTrace, + DeletedWorkbookProperties, + DeletedWorkbookResource, ErrorFieldContract, ErrorResponse, + ErrorResponseComponents, + ErrorResponseComponentsError, + ErrorResponseLinkedStorage, + ErrorResponseLinkedStorageError, + HeaderField, InnerError, - LinkProperties, - MyWorkbook, - MyWorkbookError, - MyWorkbookResource, - MyWorkbooksListResult, + LinkedStorageAccountsProperties, + LiveTokenErrorResponseLinkedStorage, + LiveTokenErrorResponseLinkedStorageError, + LiveTokenResponse, + ManagedServiceIdentity, Operation, OperationDisplay, - OperationListResult, PrivateLinkScopedResource, + ProxyResource, + Resource, + SystemData, TagsResource, + TrackedResource, + UserAssignedIdentity, WebTest, WebTestGeolocation, - WebTestListResult, + WebTestProperties, WebTestPropertiesConfiguration, + WebTestPropertiesRequest, + WebTestPropertiesValidationRules, + WebTestPropertiesValidationRulesContentValidation, + WebTestTagsResource, WebtestsResource, WorkItemConfiguration, WorkItemConfigurationError, - WorkItemConfigurationsListResult, WorkItemCreateConfiguration, Workbook, WorkbookError, - WorkbookResource, - WorkbooksListResult, + WorkbookErrorDefinition, + WorkbookInnerErrorTrace, + WorkbookProperties, + WorkbookPropertiesUpdateParameters, + WorkbookResourceIdentity, + WorkbookTemplate, + WorkbookTemplateError, + WorkbookTemplateErrorBody, + WorkbookTemplateErrorFieldContract, + WorkbookTemplateGallery, + WorkbookTemplateLocalizedGallery, + WorkbookTemplateProperties, + WorkbookTemplateUpdateParameters, + WorkbookUpdateParameters, ) -from ._application_insights_management_client_enums import ( # type: ignore +from ._enums import ( # type: ignore ApplicationType, CategoryType, + CreatedByType, + DeletedWorkbookCategoryType, + DeletedWorkbookSharedTypeKind, FavoriteSourceType, FavoriteType, FlowType, @@ -82,10 +114,14 @@ ItemScopePath, ItemType, ItemTypeParameter, + ManagedServiceIdentityType, + PublicNetworkAccessType, PurgeState, RequestSource, - SharedTypeKind, + StorageType, WebTestKind, + WorkbookSharedTypeKind, + WorkbookUpdateSharedTypeKind, ) from ._patch import __all__ as _patch_all from ._patch import * @@ -95,10 +131,8 @@ "APIKeyRequest", "Annotation", "AnnotationError", - "AnnotationsListResult", "ApplicationInsightsComponent", "ApplicationInsightsComponentAPIKey", - "ApplicationInsightsComponentAPIKeyListResult", "ApplicationInsightsComponentAnalyticsItem", "ApplicationInsightsComponentAnalyticsItemProperties", "ApplicationInsightsComponentAvailableFeatures", @@ -110,45 +144,79 @@ "ApplicationInsightsComponentFeature", "ApplicationInsightsComponentFeatureCapabilities", "ApplicationInsightsComponentFeatureCapability", - "ApplicationInsightsComponentListResult", "ApplicationInsightsComponentProactiveDetectionConfiguration", "ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions", + "ApplicationInsightsComponentProperties", "ApplicationInsightsComponentQuotaStatus", "ApplicationInsightsComponentWebTestLocation", - "ApplicationInsightsWebTestLocationsListResult", + "ComponentLinkedStorageAccounts", + "ComponentLinkedStorageAccountsPatch", "ComponentPurgeBody", "ComponentPurgeBodyFilters", "ComponentPurgeResponse", "ComponentPurgeStatusResponse", "ComponentsResource", + "DeletedWorkbook", + "DeletedWorkbookError", + "DeletedWorkbookErrorDefinition", + "DeletedWorkbookInnerErrorTrace", + "DeletedWorkbookProperties", + "DeletedWorkbookResource", "ErrorFieldContract", "ErrorResponse", + "ErrorResponseComponents", + "ErrorResponseComponentsError", + "ErrorResponseLinkedStorage", + "ErrorResponseLinkedStorageError", + "HeaderField", "InnerError", - "LinkProperties", - "MyWorkbook", - "MyWorkbookError", - "MyWorkbookResource", - "MyWorkbooksListResult", + "LinkedStorageAccountsProperties", + "LiveTokenErrorResponseLinkedStorage", + "LiveTokenErrorResponseLinkedStorageError", + "LiveTokenResponse", + "ManagedServiceIdentity", "Operation", "OperationDisplay", - "OperationListResult", "PrivateLinkScopedResource", + "ProxyResource", + "Resource", + "SystemData", "TagsResource", + "TrackedResource", + "UserAssignedIdentity", "WebTest", "WebTestGeolocation", - "WebTestListResult", + "WebTestProperties", "WebTestPropertiesConfiguration", + "WebTestPropertiesRequest", + "WebTestPropertiesValidationRules", + "WebTestPropertiesValidationRulesContentValidation", + "WebTestTagsResource", "WebtestsResource", "WorkItemConfiguration", "WorkItemConfigurationError", - "WorkItemConfigurationsListResult", "WorkItemCreateConfiguration", "Workbook", "WorkbookError", - "WorkbookResource", - "WorkbooksListResult", + "WorkbookErrorDefinition", + "WorkbookInnerErrorTrace", + "WorkbookProperties", + "WorkbookPropertiesUpdateParameters", + "WorkbookResourceIdentity", + "WorkbookTemplate", + "WorkbookTemplateError", + "WorkbookTemplateErrorBody", + "WorkbookTemplateErrorFieldContract", + "WorkbookTemplateGallery", + "WorkbookTemplateLocalizedGallery", + "WorkbookTemplateProperties", + "WorkbookTemplateUpdateParameters", + "WorkbookUpdateParameters", "ApplicationType", "CategoryType", + "CreatedByType", + "DeletedWorkbookCategoryType", + "DeletedWorkbookSharedTypeKind", "FavoriteSourceType", "FavoriteType", "FlowType", @@ -157,10 +225,14 @@ "ItemScopePath", "ItemType", "ItemTypeParameter", + "ManagedServiceIdentityType", + "PublicNetworkAccessType", "PurgeState", "RequestSource", - "SharedTypeKind", + "StorageType", "WebTestKind", + "WorkbookSharedTypeKind", + "WorkbookUpdateSharedTypeKind", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_enums.py new file mode 100644 index 000000000000..09df337edec8 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_enums.py @@ -0,0 +1,242 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class ApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of application being monitored.""" + + WEB = "web" + """web.""" + OTHER = "other" + """other.""" + + +class CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of CategoryType.""" + + WORKBOOK = "workbook" + """workbook.""" + TSG = "TSG" + """TSG.""" + PERFORMANCE = "performance" + """performance.""" + RETENTION = "retention" + """retention.""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of entity that created the resource.""" + + USER = "User" + """The entity was created by a user.""" + APPLICATION = "Application" + """The entity was created by an application.""" + MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" + KEY = "Key" + """The entity was created by a key.""" + + +class DeletedWorkbookCategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of DeletedWorkbookCategoryType.""" + + WORKBOOK = "workbook" + """workbook.""" + TSG = "TSG" + """TSG.""" + PERFORMANCE = "performance" + """performance.""" + RETENTION = "retention" + """retention.""" + + +class DeletedWorkbookSharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of workbook. Only valid value is shared.""" + + SHARED = "shared" + """shared.""" + + +class FavoriteSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of FavoriteSourceType.""" + + RETENTION = "retention" + """retention.""" + NOTEBOOK = "notebook" + """notebook.""" + SESSIONS = "sessions" + """sessions.""" + EVENTS = "events" + """events.""" + USERFLOWS = "userflows" + """userflows.""" + FUNNEL = "funnel" + """funnel.""" + IMPACT = "impact" + """impact.""" + SEGMENTATION = "segmentation" + """segmentation.""" + + +class FavoriteType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum indicating if this favorite definition is owned by a specific user or is shared between + all users with access to the Application Insights component. + """ + + SHARED = "shared" + """shared.""" + USER = "user" + """user.""" + + +class FlowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Used by the Application Insights system to determine what kind of flow this component was + created by. This is to be set to 'Bluefield' when creating/updating a component via the REST + API. + """ + + BLUEFIELD = "Bluefield" + """Bluefield.""" + + +class IngestionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates the flow of the ingestion.""" + + APPLICATION_INSIGHTS = "ApplicationInsights" + """ApplicationInsights.""" + APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS = "ApplicationInsightsWithDiagnosticSettings" + """ApplicationInsightsWithDiagnosticSettings.""" + LOG_ANALYTICS = "LogAnalytics" + """LogAnalytics.""" + + +class ItemScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum indicating if this item definition is owned by a specific user or is shared between all + users with access to the Application Insights component. + """ + + SHARED = "shared" + """shared.""" + USER = "user" + """user.""" + + +class ItemScopePath(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ItemScopePath.""" + + ANALYTICS_ITEMS = "analyticsItems" + """analyticsItems.""" + MYANALYTICS_ITEMS = "myanalyticsItems" + """myanalyticsItems.""" + + +class ItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum indicating the type of the Analytics item.""" + + NONE = "none" + """none.""" + QUERY = "query" + """query.""" + RECENT = "recent" + """recent.""" + FUNCTION = "function" + """function.""" + + +class ItemTypeParameter(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of ItemTypeParameter.""" + + NONE = "none" + """none.""" + QUERY = "query" + """query.""" + FUNCTION = "function" + """function.""" + FOLDER = "folder" + """folder.""" + RECENT = "recent" + """recent.""" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + """No managed identity.""" + SYSTEM_ASSIGNED = "SystemAssigned" + """System assigned managed identity.""" + USER_ASSIGNED = "UserAssigned" + """User assigned managed identity.""" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + """System and user assigned managed identity.""" + + +class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The network access type for operating on the Application Insights Component. By default it is + Enabled. + """ + + ENABLED = "Enabled" + """Enables connectivity to Application Insights through public DNS.""" + DISABLED = "Disabled" + """Disables public connectivity to Application Insights through public DNS.""" + + +class PurgeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the operation represented by the requested Id.""" + + PENDING = "pending" + """pending.""" + COMPLETED = "completed" + """completed.""" + + +class RequestSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes what tool created this Application Insights component. Customers using this API + should set this to the default 'rest'. + """ + + REST = "rest" + """rest.""" + + +class StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of StorageType.""" + + SERVICE_PROFILER = "ServiceProfiler" + """ServiceProfiler.""" + + +class WebTestKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of WebTest that this web test watches. Choices are ping, multistep and standard.""" + + PING = "ping" + """ping.""" + MULTISTEP = "multistep" + """multistep.""" + STANDARD = "standard" + """standard.""" + + +class WorkbookSharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of workbook. Only valid value is shared.""" + + SHARED = "shared" + """shared.""" + + +class WorkbookUpdateSharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of workbook. Only valid value is shared.""" + + SHARED = "shared" + """shared.""" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_models.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_models.py new file mode 100644 index 000000000000..afcc1a87d902 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_models.py @@ -0,0 +1,4079 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class Annotation(_Model): + """Annotation associated with an application insights resource. + + :ivar annotation_name: Name of annotation. + :vartype annotation_name: str + :ivar category: Category of annotation, free form. + :vartype category: str + :ivar event_time: Time when event occurred. + :vartype event_time: ~datetime.datetime + :ivar id: Unique Id for annotation. + :vartype id: str + :ivar properties: Serialized JSON object for detailed properties. + :vartype properties: str + :ivar related_annotation: Related parent annotation if any. + :vartype related_annotation: str + """ + + annotation_name: Optional[str] = rest_field( + name="AnnotationName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of annotation.""" + category: Optional[str] = rest_field(name="Category", visibility=["read", "create", "update", "delete", "query"]) + """Category of annotation, free form.""" + event_time: Optional[datetime.datetime] = rest_field( + name="EventTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Time when event occurred.""" + id: Optional[str] = rest_field(name="Id", visibility=["read", "create", "update", "delete", "query"]) + """Unique Id for annotation.""" + properties: Optional[str] = rest_field( + name="Properties", visibility=["read", "create", "update", "delete", "query"] + ) + """Serialized JSON object for detailed properties.""" + related_annotation: Optional[str] = rest_field( + name="RelatedAnnotation", visibility=["read", "create", "update", "delete", "query"] + ) + """Related parent annotation if any.""" + + @overload + def __init__( + self, + *, + annotation_name: Optional[str] = None, + category: Optional[str] = None, + event_time: Optional[datetime.datetime] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + properties: Optional[str] = None, + related_annotation: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AnnotationError(_Model): + """Error associated with trying to create annotation with Id that already exist. + + :ivar code: Error detail code and explanation. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar innererror: Inner error. + :vartype innererror: ~azure.mgmt.applicationinsights.models.InnerError + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error detail code and explanation.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message.""" + innererror: Optional["_models.InnerError"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Inner error.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + innererror: Optional["_models.InnerError"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class APIKeyRequest(_Model): + """An Application Insights component API Key creation request definition. + + :ivar name: The name of the API Key. + :vartype name: str + :ivar linked_read_properties: The read access rights of this API Key. + :vartype linked_read_properties: list[str] + :ivar linked_write_properties: The write access rights of this API Key. + :vartype linked_write_properties: list[str] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the API Key.""" + linked_read_properties: Optional[list[str]] = rest_field( + name="linkedReadProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """The read access rights of this API Key.""" + linked_write_properties: Optional[list[str]] = rest_field( + name="linkedWriteProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """The write access rights of this API Key.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + linked_read_properties: Optional[list[str]] = None, + linked_write_properties: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ComponentsResource(_Model): + """An azure resource object. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Azure resource Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Azure resource name.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Azure resource type.""" + location: str = rest_field(visibility=["read", "create"]) + """Resource location. Required.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponent(ComponentsResource): + """An Application Insights component definition. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind of application that this component refers to, used to customize UI. This + value is a freeform string, values should typically be one of the following: web, ios, other, + store, java, phone. Required. + :vartype kind: str + :ivar etag: Resource etag. + :vartype etag: str + :ivar properties: Properties that define an Application Insights component resource. + :vartype properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProperties + """ + + kind: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The kind of application that this component refers to, used to customize UI. This value is a + freeform string, values should typically be one of the following: web, ios, other, store, java, + phone. Required.""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource etag.""" + properties: Optional["_models.ApplicationInsightsComponentProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties that define an Application Insights component resource.""" + + __flattened_items = [ + "application_id", + "app_id", + "name", + "application_type", + "flow_type", + "request_source", + "instrumentation_key", + "creation_date", + "tenant_id", + "hockey_app_id", + "hockey_app_token", + "provisioning_state", + "sampling_percentage", + "connection_string", + "retention_in_days", + "disable_ip_masking", + "immediate_purge_data_on30_days", + "workspace_resource_id", + "la_migration_date", + "private_link_scoped_resources", + "public_network_access_for_ingestion", + "public_network_access_for_query", + "ingestion_mode", + "disable_local_auth", + "force_customer_storage_for_profiler", + ] + + @overload + def __init__( + self, + *, + location: str, + kind: str, + tags: Optional[dict[str, str]] = None, + etag: Optional[str] = None, + properties: Optional["_models.ApplicationInsightsComponentProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ApplicationInsightsComponentAnalyticsItem(_Model): # pylint: disable=name-too-long + """Properties that define an Analytics item that is associated to an Application Insights + component. + + :ivar id: Internally assigned unique id of the item definition. + :vartype id: str + :ivar name: The user-defined name of the item. + :vartype name: str + :ivar content: The content of this item. + :vartype content: str + :ivar version: This instance's version of the data model. This can change as new features are + added. + :vartype version: str + :ivar scope: Enum indicating if this item definition is owned by a specific user or is shared + between all users with access to the Application Insights component. Known values are: "shared" + and "user". + :vartype scope: str or ~azure.mgmt.applicationinsights.models.ItemScope + :ivar type: Enum indicating the type of the Analytics item. Known values are: "none", "query", + "recent", and "function". + :vartype type: str or ~azure.mgmt.applicationinsights.models.ItemType + :ivar time_created: Date and time in UTC when this item was created. + :vartype time_created: str + :ivar time_modified: Date and time in UTC of the last modification that was made to this item. + :vartype time_modified: str + :ivar properties: A set of properties that can be defined in the context of a specific item + type. Each type may have its own properties. + :vartype properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItemProperties + """ + + id: Optional[str] = rest_field(name="Id", visibility=["read", "create", "update", "delete", "query"]) + """Internally assigned unique id of the item definition.""" + name: Optional[str] = rest_field(name="Name", visibility=["read", "create", "update", "delete", "query"]) + """The user-defined name of the item.""" + content: Optional[str] = rest_field(name="Content", visibility=["read", "create", "update", "delete", "query"]) + """The content of this item.""" + version: Optional[str] = rest_field(name="Version", visibility=["read"]) + """This instance's version of the data model. This can change as new features are added.""" + scope: Optional[Union[str, "_models.ItemScope"]] = rest_field( + name="Scope", visibility=["read", "create", "update", "delete", "query"] + ) + """Enum indicating if this item definition is owned by a specific user or is shared between all + users with access to the Application Insights component. Known values are: \"shared\" and + \"user\".""" + type: Optional[Union[str, "_models.ItemType"]] = rest_field( + name="Type", visibility=["read", "create", "update", "delete", "query"] + ) + """Enum indicating the type of the Analytics item. Known values are: \"none\", \"query\", + \"recent\", and \"function\".""" + time_created: Optional[str] = rest_field(name="TimeCreated", visibility=["read"]) + """Date and time in UTC when this item was created.""" + time_modified: Optional[str] = rest_field(name="TimeModified", visibility=["read"]) + """Date and time in UTC of the last modification that was made to this item.""" + properties: Optional["_models.ApplicationInsightsComponentAnalyticsItemProperties"] = rest_field( + name="Properties", visibility=["read", "create", "update", "delete", "query"] + ) + """A set of properties that can be defined in the context of a specific item type. Each type may + have its own properties.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + content: Optional[str] = None, + scope: Optional[Union[str, "_models.ItemScope"]] = None, + type: Optional[Union[str, "_models.ItemType"]] = None, + properties: Optional["_models.ApplicationInsightsComponentAnalyticsItemProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentAnalyticsItemProperties(_Model): # pylint: disable=name-too-long + """A set of properties that can be defined in the context of a specific item type. Each type may + have its own properties. + + :ivar function_alias: A function alias, used when the type of the item is Function. + :vartype function_alias: str + """ + + function_alias: Optional[str] = rest_field( + name="functionAlias", visibility=["read", "create", "update", "delete", "query"] + ) + """A function alias, used when the type of the item is Function.""" + + @overload + def __init__( + self, + *, + function_alias: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentAPIKey(_Model): + """Properties that define an API key of an Application Insights Component. + + :ivar id: The unique ID of the API key inside an Application Insights component. It is auto + generated when the API key is created. + :vartype id: str + :ivar api_key: The API key value. It will be only return once when the API Key was created. + :vartype api_key: str + :ivar created_date: The create date of this API key. + :vartype created_date: str + :ivar name: The name of the API key. + :vartype name: str + :ivar linked_read_properties: The read access rights of this API Key. + :vartype linked_read_properties: list[str] + :ivar linked_write_properties: The write access rights of this API Key. + :vartype linked_write_properties: list[str] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The unique ID of the API key inside an Application Insights component. It is auto generated + when the API key is created.""" + api_key: Optional[str] = rest_field(name="apiKey", visibility=["read"]) + """The API key value. It will be only return once when the API Key was created.""" + created_date: Optional[str] = rest_field( + name="createdDate", visibility=["read", "create", "update", "delete", "query"] + ) + """The create date of this API key.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the API key.""" + linked_read_properties: Optional[list[str]] = rest_field( + name="linkedReadProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """The read access rights of this API Key.""" + linked_write_properties: Optional[list[str]] = rest_field( + name="linkedWriteProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """The write access rights of this API Key.""" + + @overload + def __init__( + self, + *, + created_date: Optional[str] = None, + name: Optional[str] = None, + linked_read_properties: Optional[list[str]] = None, + linked_write_properties: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentAvailableFeatures(_Model): # pylint: disable=name-too-long + """An Application Insights component available features. + + :ivar result: A list of Application Insights component feature. + :vartype result: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeature] + """ + + result: Optional[list["_models.ApplicationInsightsComponentFeature"]] = rest_field( + name="Result", visibility=["read"] + ) + """A list of Application Insights component feature.""" + + +class ApplicationInsightsComponentBillingFeatures(_Model): # pylint: disable=name-too-long + """An Application Insights component billing features. + + :ivar data_volume_cap: An Application Insights component daily data volume cap. + :vartype data_volume_cap: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentDataVolumeCap + :ivar current_billing_features: Current enabled pricing plan. When the component is in the + Enterprise plan, this will list both 'Basic' and 'Application Insights Enterprise'. + :vartype current_billing_features: list[str] + """ + + data_volume_cap: Optional["_models.ApplicationInsightsComponentDataVolumeCap"] = rest_field( + name="DataVolumeCap", visibility=["read", "create", "update", "delete", "query"] + ) + """An Application Insights component daily data volume cap.""" + current_billing_features: Optional[list[str]] = rest_field( + name="CurrentBillingFeatures", visibility=["read", "create", "update", "delete", "query"] + ) + """Current enabled pricing plan. When the component is in the Enterprise plan, this will list both + 'Basic' and 'Application Insights Enterprise'.""" + + @overload + def __init__( + self, + *, + data_volume_cap: Optional["_models.ApplicationInsightsComponentDataVolumeCap"] = None, + current_billing_features: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentDataVolumeCap(_Model): # pylint: disable=name-too-long + """An Application Insights component daily data volume cap. + + :ivar cap: Daily data volume cap in GB. + :vartype cap: float + :ivar reset_time: Daily data volume cap UTC reset hour. + :vartype reset_time: int + :ivar warning_threshold: Reserved, not used for now. + :vartype warning_threshold: int + :ivar stop_send_notification_when_hit_threshold: Reserved, not used for now. + :vartype stop_send_notification_when_hit_threshold: bool + :ivar stop_send_notification_when_hit_cap: Do not send a notification email when the daily data + volume cap is met. + :vartype stop_send_notification_when_hit_cap: bool + :ivar max_history_cap: Maximum daily data volume cap that the user can set for this component. + :vartype max_history_cap: float + """ + + cap: Optional[float] = rest_field(name="Cap", visibility=["read", "create", "update", "delete", "query"]) + """Daily data volume cap in GB.""" + reset_time: Optional[int] = rest_field(name="ResetTime", visibility=["read"]) + """Daily data volume cap UTC reset hour.""" + warning_threshold: Optional[int] = rest_field( + name="WarningThreshold", visibility=["read", "create", "update", "delete", "query"] + ) + """Reserved, not used for now.""" + stop_send_notification_when_hit_threshold: Optional[bool] = rest_field( + name="StopSendNotificationWhenHitThreshold", visibility=["read", "create", "update", "delete", "query"] + ) + """Reserved, not used for now.""" + stop_send_notification_when_hit_cap: Optional[bool] = rest_field( + name="StopSendNotificationWhenHitCap", visibility=["read", "create", "update", "delete", "query"] + ) + """Do not send a notification email when the daily data volume cap is met.""" + max_history_cap: Optional[float] = rest_field(name="MaxHistoryCap", visibility=["read"]) + """Maximum daily data volume cap that the user can set for this component.""" + + @overload + def __init__( + self, + *, + cap: Optional[float] = None, + warning_threshold: Optional[int] = None, + stop_send_notification_when_hit_threshold: Optional[bool] = None, + stop_send_notification_when_hit_cap: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentExportConfiguration(_Model): # pylint: disable=name-too-long + """Properties that define a Continuous Export configuration. + + :ivar export_id: The unique ID of the export configuration inside an Application Insights + component. It is auto generated when the Continuous Export configuration is created. + :vartype export_id: str + :ivar instrumentation_key: The instrumentation key of the Application Insights component. + :vartype instrumentation_key: str + :ivar record_types: This comma separated list of document types that will be exported. The + possible values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', + 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. + :vartype record_types: str + :ivar application_name: The name of the Application Insights component. + :vartype application_name: str + :ivar subscription_id: The subscription of the Application Insights component. + :vartype subscription_id: str + :ivar resource_group: The resource group of the Application Insights component. + :vartype resource_group: str + :ivar destination_storage_subscription_id: The destination storage account subscription ID. + :vartype destination_storage_subscription_id: str + :ivar destination_storage_location_id: The destination account location ID. + :vartype destination_storage_location_id: str + :ivar destination_account_id: The name of destination account. + :vartype destination_account_id: str + :ivar destination_type: The destination type. + :vartype destination_type: str + :ivar is_user_enabled: This will be 'true' if the Continuous Export configuration is enabled, + otherwise it will be 'false'. + :vartype is_user_enabled: str + :ivar last_user_update: Last time the Continuous Export configuration was updated. + :vartype last_user_update: str + :ivar notification_queue_enabled: Deprecated. + :vartype notification_queue_enabled: str + :ivar export_status: This indicates current Continuous Export configuration status. The + possible values are 'Preparing', 'Success', 'Failure'. + :vartype export_status: str + :ivar last_success_time: The last time data was successfully delivered to the destination + storage container for this Continuous Export configuration. + :vartype last_success_time: str + :ivar last_gap_time: The last time the Continuous Export configuration started failing. + :vartype last_gap_time: str + :ivar permanent_error_reason: This is the reason the Continuous Export configuration started + failing. It can be 'AzureStorageNotFound' or 'AzureStorageAccessDenied'. + :vartype permanent_error_reason: str + :ivar storage_name: The name of the destination storage account. + :vartype storage_name: str + :ivar container_name: The name of the destination storage container. + :vartype container_name: str + """ + + export_id: Optional[str] = rest_field(name="ExportId", visibility=["read"]) + """The unique ID of the export configuration inside an Application Insights component. It is auto + generated when the Continuous Export configuration is created.""" + instrumentation_key: Optional[str] = rest_field(name="InstrumentationKey", visibility=["read"]) + """The instrumentation key of the Application Insights component.""" + record_types: Optional[str] = rest_field( + name="RecordTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """This comma separated list of document types that will be exported. The possible values include + 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + 'PerformanceCounters', 'Availability', 'Messages'.""" + application_name: Optional[str] = rest_field(name="ApplicationName", visibility=["read"]) + """The name of the Application Insights component.""" + subscription_id: Optional[str] = rest_field(name="SubscriptionId", visibility=["read"]) + """The subscription of the Application Insights component.""" + resource_group: Optional[str] = rest_field(name="ResourceGroup", visibility=["read"]) + """The resource group of the Application Insights component.""" + destination_storage_subscription_id: Optional[str] = rest_field( + name="DestinationStorageSubscriptionId", visibility=["read"] + ) + """The destination storage account subscription ID.""" + destination_storage_location_id: Optional[str] = rest_field( + name="DestinationStorageLocationId", visibility=["read"] + ) + """The destination account location ID.""" + destination_account_id: Optional[str] = rest_field(name="DestinationAccountId", visibility=["read"]) + """The name of destination account.""" + destination_type: Optional[str] = rest_field(name="DestinationType", visibility=["read"]) + """The destination type.""" + is_user_enabled: Optional[str] = rest_field(name="IsUserEnabled", visibility=["read"]) + """This will be 'true' if the Continuous Export configuration is enabled, otherwise it will be + 'false'.""" + last_user_update: Optional[str] = rest_field(name="LastUserUpdate", visibility=["read"]) + """Last time the Continuous Export configuration was updated.""" + notification_queue_enabled: Optional[str] = rest_field( + name="NotificationQueueEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Deprecated.""" + export_status: Optional[str] = rest_field(name="ExportStatus", visibility=["read"]) + """This indicates current Continuous Export configuration status. The possible values are + 'Preparing', 'Success', 'Failure'.""" + last_success_time: Optional[str] = rest_field(name="LastSuccessTime", visibility=["read"]) + """The last time data was successfully delivered to the destination storage container for this + Continuous Export configuration.""" + last_gap_time: Optional[str] = rest_field(name="LastGapTime", visibility=["read"]) + """The last time the Continuous Export configuration started failing.""" + permanent_error_reason: Optional[str] = rest_field(name="PermanentErrorReason", visibility=["read"]) + """This is the reason the Continuous Export configuration started failing. It can be + 'AzureStorageNotFound' or 'AzureStorageAccessDenied'.""" + storage_name: Optional[str] = rest_field(name="StorageName", visibility=["read"]) + """The name of the destination storage account.""" + container_name: Optional[str] = rest_field(name="ContainerName", visibility=["read"]) + """The name of the destination storage container.""" + + @overload + def __init__( + self, + *, + record_types: Optional[str] = None, + notification_queue_enabled: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentExportRequest(_Model): # pylint: disable=name-too-long + """An Application Insights component Continuous Export configuration request definition. + + :ivar record_types: The document types to be exported, as comma separated values. Allowed + values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', + 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. + :vartype record_types: str + :ivar destination_type: The Continuous Export destination type. This has to be 'Blob'. + :vartype destination_type: str + :ivar destination_address: The SAS URL for the destination storage container. It must grant + write permission. + :vartype destination_address: str + :ivar is_enabled: Set to 'true' to create a Continuous Export configuration as enabled, + otherwise set it to 'false'. + :vartype is_enabled: str + :ivar notification_queue_enabled: Deprecated. + :vartype notification_queue_enabled: str + :ivar notification_queue_uri: Deprecated. + :vartype notification_queue_uri: str + :ivar destination_storage_subscription_id: The subscription ID of the destination storage + container. + :vartype destination_storage_subscription_id: str + :ivar destination_storage_location_id: The location ID of the destination storage container. + :vartype destination_storage_location_id: str + :ivar destination_account_id: The name of destination storage account. + :vartype destination_account_id: str + """ + + record_types: Optional[str] = rest_field( + name="RecordTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """The document types to be exported, as comma separated values. Allowed values include + 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', + 'PerformanceCounters', 'Availability', 'Messages'.""" + destination_type: Optional[str] = rest_field( + name="DestinationType", visibility=["read", "create", "update", "delete", "query"] + ) + """The Continuous Export destination type. This has to be 'Blob'.""" + destination_address: Optional[str] = rest_field( + name="DestinationAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """The SAS URL for the destination storage container. It must grant write permission.""" + is_enabled: Optional[str] = rest_field(name="IsEnabled", visibility=["read", "create", "update", "delete", "query"]) + """Set to 'true' to create a Continuous Export configuration as enabled, otherwise set it to + 'false'.""" + notification_queue_enabled: Optional[str] = rest_field( + name="NotificationQueueEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Deprecated.""" + notification_queue_uri: Optional[str] = rest_field( + name="NotificationQueueUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Deprecated.""" + destination_storage_subscription_id: Optional[str] = rest_field( + name="DestinationStorageSubscriptionId", visibility=["read", "create", "update", "delete", "query"] + ) + """The subscription ID of the destination storage container.""" + destination_storage_location_id: Optional[str] = rest_field( + name="DestinationStorageLocationId", visibility=["read", "create", "update", "delete", "query"] + ) + """The location ID of the destination storage container.""" + destination_account_id: Optional[str] = rest_field( + name="DestinationAccountId", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of destination storage account.""" + + @overload + def __init__( + self, + *, + record_types: Optional[str] = None, + destination_type: Optional[str] = None, + destination_address: Optional[str] = None, + is_enabled: Optional[str] = None, + notification_queue_enabled: Optional[str] = None, + notification_queue_uri: Optional[str] = None, + destination_storage_subscription_id: Optional[str] = None, + destination_storage_location_id: Optional[str] = None, + destination_account_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentFavorite(_Model): + """Properties that define a favorite that is associated to an Application Insights component. + + :ivar name: The user-defined name of the favorite. + :vartype name: str + :ivar config: Configuration of this particular favorite, which are driven by the Azure portal + UX. Configuration data is a string containing valid JSON. + :vartype config: str + :ivar version: This instance's version of the data model. This can change as new features are + added that can be marked favorite. Current examples include MetricsExplorer (ME) and Search. + :vartype version: str + :ivar favorite_id: Internally assigned unique id of the favorite definition. + :vartype favorite_id: str + :ivar favorite_type: Enum indicating if this favorite definition is owned by a specific user or + is shared between all users with access to the Application Insights component. Known values + are: "shared" and "user". + :vartype favorite_type: str or ~azure.mgmt.applicationinsights.models.FavoriteType + :ivar source_type: The source of the favorite definition. + :vartype source_type: str + :ivar time_modified: Date and time in UTC of the last modification that was made to this + favorite definition. + :vartype time_modified: str + :ivar tags: A list of 0 or more tags that are associated with this favorite definition. + :vartype tags: list[str] + :ivar category: Favorite category, as defined by the user at creation time. + :vartype category: str + :ivar is_generated_from_template: Flag denoting wether or not this favorite was generated from + a template. + :vartype is_generated_from_template: bool + :ivar user_id: Unique user id of the specific user that owns this favorite. + :vartype user_id: str + """ + + name: Optional[str] = rest_field(name="Name", visibility=["read", "create", "update", "delete", "query"]) + """The user-defined name of the favorite.""" + config: Optional[str] = rest_field(name="Config", visibility=["read", "create", "update", "delete", "query"]) + """Configuration of this particular favorite, which are driven by the Azure portal UX. + Configuration data is a string containing valid JSON.""" + version: Optional[str] = rest_field(name="Version", visibility=["read", "create", "update", "delete", "query"]) + """This instance's version of the data model. This can change as new features are added that can + be marked favorite. Current examples include MetricsExplorer (ME) and Search.""" + favorite_id: Optional[str] = rest_field(name="FavoriteId", visibility=["read"]) + """Internally assigned unique id of the favorite definition.""" + favorite_type: Optional[Union[str, "_models.FavoriteType"]] = rest_field( + name="FavoriteType", visibility=["read", "create", "update", "delete", "query"] + ) + """Enum indicating if this favorite definition is owned by a specific user or is shared between + all users with access to the Application Insights component. Known values are: \"shared\" and + \"user\".""" + source_type: Optional[str] = rest_field( + name="SourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """The source of the favorite definition.""" + time_modified: Optional[str] = rest_field(name="TimeModified", visibility=["read"]) + """Date and time in UTC of the last modification that was made to this favorite definition.""" + tags: Optional[list[str]] = rest_field(name="Tags", visibility=["read", "create", "update", "delete", "query"]) + """A list of 0 or more tags that are associated with this favorite definition.""" + category: Optional[str] = rest_field(name="Category", visibility=["read", "create", "update", "delete", "query"]) + """Favorite category, as defined by the user at creation time.""" + is_generated_from_template: Optional[bool] = rest_field( + name="IsGeneratedFromTemplate", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag denoting wether or not this favorite was generated from a template.""" + user_id: Optional[str] = rest_field(name="UserId", visibility=["read"]) + """Unique user id of the specific user that owns this favorite.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + config: Optional[str] = None, + version: Optional[str] = None, + favorite_type: Optional[Union[str, "_models.FavoriteType"]] = None, + source_type: Optional[str] = None, + tags: Optional[list[str]] = None, + category: Optional[str] = None, + is_generated_from_template: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentFeature(_Model): + """An Application Insights component daily data volume cap status. + + :ivar feature_name: The pricing feature name. + :vartype feature_name: str + :ivar meter_id: The meter id used for the feature. + :vartype meter_id: str + :ivar meter_rate_frequency: The meter rate for the feature's meter. + :vartype meter_rate_frequency: str + :ivar resouce_id: Reserved, not used now. + :vartype resouce_id: str + :ivar is_hidden: Reserved, not used now. + :vartype is_hidden: bool + :ivar capabilities: A list of Application Insights component feature capability. + :vartype capabilities: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeatureCapability] + :ivar title: Display name of the feature. + :vartype title: str + :ivar is_main_feature: Whether can apply addon feature on to it. + :vartype is_main_feature: bool + :ivar supported_addon_features: The add on features on main feature. + :vartype supported_addon_features: str + """ + + feature_name: Optional[str] = rest_field(name="FeatureName", visibility=["read"]) + """The pricing feature name.""" + meter_id: Optional[str] = rest_field(name="MeterId", visibility=["read"]) + """The meter id used for the feature.""" + meter_rate_frequency: Optional[str] = rest_field(name="MeterRateFrequency", visibility=["read"]) + """The meter rate for the feature's meter.""" + resouce_id: Optional[str] = rest_field(name="ResouceId", visibility=["read"]) + """Reserved, not used now.""" + is_hidden: Optional[bool] = rest_field(name="IsHidden", visibility=["read"]) + """Reserved, not used now.""" + capabilities: Optional[list["_models.ApplicationInsightsComponentFeatureCapability"]] = rest_field( + name="Capabilities", visibility=["read"] + ) + """A list of Application Insights component feature capability.""" + title: Optional[str] = rest_field(name="Title", visibility=["read"]) + """Display name of the feature.""" + is_main_feature: Optional[bool] = rest_field(name="IsMainFeature", visibility=["read"]) + """Whether can apply addon feature on to it.""" + supported_addon_features: Optional[str] = rest_field(name="SupportedAddonFeatures", visibility=["read"]) + """The add on features on main feature.""" + + +class ApplicationInsightsComponentFeatureCapabilities(_Model): # pylint: disable=name-too-long + """An Application Insights component feature capabilities. + + :ivar support_export_data: Whether allow to use continuous export feature. + :vartype support_export_data: bool + :ivar burst_throttle_policy: Reserved, not used now. + :vartype burst_throttle_policy: str + :ivar metadata_class: Reserved, not used now. + :vartype metadata_class: str + :ivar live_stream_metrics: Reserved, not used now. + :vartype live_stream_metrics: bool + :ivar application_map: Reserved, not used now. + :vartype application_map: bool + :ivar work_item_integration: Whether allow to use work item integration feature. + :vartype work_item_integration: bool + :ivar power_bi_integration: Reserved, not used now. + :vartype power_bi_integration: bool + :ivar open_schema: Reserved, not used now. + :vartype open_schema: bool + :ivar proactive_detection: Reserved, not used now. + :vartype proactive_detection: bool + :ivar analytics_integration: Reserved, not used now. + :vartype analytics_integration: bool + :ivar multiple_step_web_test: Whether allow to use multiple steps web test feature. + :vartype multiple_step_web_test: bool + :ivar api_access_level: Reserved, not used now. + :vartype api_access_level: str + :ivar tracking_type: The application insights component used tracking type. + :vartype tracking_type: str + :ivar daily_cap: Daily data volume cap in GB. + :vartype daily_cap: float + :ivar daily_cap_reset_time: Daily data volume cap UTC reset hour. + :vartype daily_cap_reset_time: float + :ivar throttle_rate: Reserved, not used now. + :vartype throttle_rate: float + """ + + support_export_data: Optional[bool] = rest_field(name="SupportExportData", visibility=["read"]) + """Whether allow to use continuous export feature.""" + burst_throttle_policy: Optional[str] = rest_field(name="BurstThrottlePolicy", visibility=["read"]) + """Reserved, not used now.""" + metadata_class: Optional[str] = rest_field(name="MetadataClass", visibility=["read"]) + """Reserved, not used now.""" + live_stream_metrics: Optional[bool] = rest_field(name="LiveStreamMetrics", visibility=["read"]) + """Reserved, not used now.""" + application_map: Optional[bool] = rest_field(name="ApplicationMap", visibility=["read"]) + """Reserved, not used now.""" + work_item_integration: Optional[bool] = rest_field(name="WorkItemIntegration", visibility=["read"]) + """Whether allow to use work item integration feature.""" + power_bi_integration: Optional[bool] = rest_field(name="PowerBIIntegration", visibility=["read"]) + """Reserved, not used now.""" + open_schema: Optional[bool] = rest_field(name="OpenSchema", visibility=["read"]) + """Reserved, not used now.""" + proactive_detection: Optional[bool] = rest_field(name="ProactiveDetection", visibility=["read"]) + """Reserved, not used now.""" + analytics_integration: Optional[bool] = rest_field(name="AnalyticsIntegration", visibility=["read"]) + """Reserved, not used now.""" + multiple_step_web_test: Optional[bool] = rest_field(name="MultipleStepWebTest", visibility=["read"]) + """Whether allow to use multiple steps web test feature.""" + api_access_level: Optional[str] = rest_field(name="ApiAccessLevel", visibility=["read"]) + """Reserved, not used now.""" + tracking_type: Optional[str] = rest_field(name="TrackingType", visibility=["read"]) + """The application insights component used tracking type.""" + daily_cap: Optional[float] = rest_field(name="DailyCap", visibility=["read"]) + """Daily data volume cap in GB.""" + daily_cap_reset_time: Optional[float] = rest_field(name="DailyCapResetTime", visibility=["read"]) + """Daily data volume cap UTC reset hour.""" + throttle_rate: Optional[float] = rest_field(name="ThrottleRate", visibility=["read"]) + """Reserved, not used now.""" + + +class ApplicationInsightsComponentFeatureCapability(_Model): # pylint: disable=name-too-long + """An Application Insights component feature capability. + + :ivar name: The name of the capability. + :vartype name: str + :ivar description: The description of the capability. + :vartype description: str + :ivar value: The value of the capability. + :vartype value: str + :ivar unit: The unit of the capability. + :vartype unit: str + :ivar meter_id: The meter used for the capability. + :vartype meter_id: str + :ivar meter_rate_frequency: The meter rate of the meter. + :vartype meter_rate_frequency: str + """ + + name: Optional[str] = rest_field(name="Name", visibility=["read"]) + """The name of the capability.""" + description: Optional[str] = rest_field(name="Description", visibility=["read"]) + """The description of the capability.""" + value: Optional[str] = rest_field(name="Value", visibility=["read"]) + """The value of the capability.""" + unit: Optional[str] = rest_field(name="Unit", visibility=["read"]) + """The unit of the capability.""" + meter_id: Optional[str] = rest_field(name="MeterId", visibility=["read"]) + """The meter used for the capability.""" + meter_rate_frequency: Optional[str] = rest_field(name="MeterRateFrequency", visibility=["read"]) + """The meter rate of the meter.""" + + +class ApplicationInsightsComponentProactiveDetectionConfiguration(_Model): # pylint: disable=name-too-long + """Properties that define a ProactiveDetection configuration. + + :ivar name: The rule name. + :vartype name: str + :ivar enabled: A flag that indicates whether this rule is enabled by the user. + :vartype enabled: bool + :ivar send_emails_to_subscription_owners: A flag that indicated whether notifications on this + rule should be sent to subscription owners. + :vartype send_emails_to_subscription_owners: bool + :ivar custom_emails: Custom email addresses for this rule notifications. + :vartype custom_emails: list[str] + :ivar last_updated_time: The last time this rule was updated. + :vartype last_updated_time: str + :ivar rule_definitions: Static definitions of the ProactiveDetection configuration rule (same + values for all components). + :vartype rule_definitions: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The rule name.""" + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A flag that indicates whether this rule is enabled by the user.""" + send_emails_to_subscription_owners: Optional[bool] = rest_field( + name="sendEmailsToSubscriptionOwners", visibility=["read", "create", "update", "delete", "query"] + ) + """A flag that indicated whether notifications on this rule should be sent to subscription owners.""" + custom_emails: Optional[list[str]] = rest_field( + name="customEmails", visibility=["read", "create", "update", "delete", "query"] + ) + """Custom email addresses for this rule notifications.""" + last_updated_time: Optional[str] = rest_field( + name="lastUpdatedTime", visibility=["read", "create", "update", "delete", "query"] + ) + """The last time this rule was updated.""" + rule_definitions: Optional["_models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions"] = ( + rest_field(name="ruleDefinitions", visibility=["read", "create", "update", "delete", "query"]) + ) + """Static definitions of the ProactiveDetection configuration rule (same values for all + components).""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + enabled: Optional[bool] = None, + send_emails_to_subscription_owners: Optional[bool] = None, + custom_emails: Optional[list[str]] = None, + last_updated_time: Optional[str] = None, + rule_definitions: Optional[ + "_models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions" + ] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions( + _Model +): # pylint: disable=name-too-long + """Static definitions of the ProactiveDetection configuration rule (same values for all + components). + + :ivar name: The rule name. + :vartype name: str + :ivar display_name: The rule name as it is displayed in UI. + :vartype display_name: str + :ivar description: The rule description. + :vartype description: str + :ivar help_url: URL which displays additional info about the proactive detection rule. + :vartype help_url: str + :ivar is_hidden: A flag indicating whether the rule is hidden (from the UI). + :vartype is_hidden: bool + :ivar is_enabled_by_default: A flag indicating whether the rule is enabled by default. + :vartype is_enabled_by_default: bool + :ivar is_in_preview: A flag indicating whether the rule is in preview. + :vartype is_in_preview: bool + :ivar supports_email_notifications: A flag indicating whether email notifications are supported + for detections for this rule. + :vartype supports_email_notifications: bool + """ + + name: Optional[str] = rest_field(name="Name", visibility=["read", "create", "update", "delete", "query"]) + """The rule name.""" + display_name: Optional[str] = rest_field( + name="DisplayName", visibility=["read", "create", "update", "delete", "query"] + ) + """The rule name as it is displayed in UI.""" + description: Optional[str] = rest_field( + name="Description", visibility=["read", "create", "update", "delete", "query"] + ) + """The rule description.""" + help_url: Optional[str] = rest_field(name="HelpUrl", visibility=["read", "create", "update", "delete", "query"]) + """URL which displays additional info about the proactive detection rule.""" + is_hidden: Optional[bool] = rest_field(name="IsHidden", visibility=["read", "create", "update", "delete", "query"]) + """A flag indicating whether the rule is hidden (from the UI).""" + is_enabled_by_default: Optional[bool] = rest_field( + name="IsEnabledByDefault", visibility=["read", "create", "update", "delete", "query"] + ) + """A flag indicating whether the rule is enabled by default.""" + is_in_preview: Optional[bool] = rest_field( + name="IsInPreview", visibility=["read", "create", "update", "delete", "query"] + ) + """A flag indicating whether the rule is in preview.""" + supports_email_notifications: Optional[bool] = rest_field( + name="SupportsEmailNotifications", visibility=["read", "create", "update", "delete", "query"] + ) + """A flag indicating whether email notifications are supported for detections for this rule.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + help_url: Optional[str] = None, + is_hidden: Optional[bool] = None, + is_enabled_by_default: Optional[bool] = None, + is_in_preview: Optional[bool] = None, + supports_email_notifications: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentProperties(_Model): + """Properties that define an Application Insights component resource. + + :ivar application_id: The unique ID of your application. This field mirrors the 'Name' field + and cannot be changed. + :vartype application_id: str + :ivar app_id: Application Insights Unique ID for your Application. + :vartype app_id: str + :ivar name: Application name. + :vartype name: str + :ivar application_type: Type of application being monitored. Required. Known values are: "web" + and "other". + :vartype application_type: str or ~azure.mgmt.applicationinsights.models.ApplicationType + :ivar flow_type: Used by the Application Insights system to determine what kind of flow this + component was created by. This is to be set to 'Bluefield' when creating/updating a component + via the REST API. "Bluefield" + :vartype flow_type: str or ~azure.mgmt.applicationinsights.models.FlowType + :ivar request_source: Describes what tool created this Application Insights component. + Customers using this API should set this to the default 'rest'. "rest" + :vartype request_source: str or ~azure.mgmt.applicationinsights.models.RequestSource + :ivar instrumentation_key: Application Insights Instrumentation key. A read-only value that + applications can use to identify the destination for all telemetry sent to Azure Application + Insights. This value will be supplied upon construction of each new Application Insights + component. + :vartype instrumentation_key: str + :ivar creation_date: Creation Date for the Application Insights component, in ISO 8601 format. + :vartype creation_date: ~datetime.datetime + :ivar tenant_id: Azure Tenant Id. + :vartype tenant_id: str + :ivar hockey_app_id: The unique application ID created when a new application is added to + HockeyApp, used for communications with HockeyApp. + :vartype hockey_app_id: str + :ivar hockey_app_token: Token used to authenticate communications with between Application + Insights and HockeyApp. + :vartype hockey_app_token: str + :ivar provisioning_state: Current state of this component: whether or not is has been + provisioned within the resource group it is defined. Users cannot change this value but are + able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + :vartype provisioning_state: str + :ivar sampling_percentage: Percentage of the data produced by the application being monitored + that is being sampled for Application Insights telemetry. + :vartype sampling_percentage: float + :ivar connection_string: Application Insights component connection string. + :vartype connection_string: str + :ivar retention_in_days: Retention period in days. + :vartype retention_in_days: int + :ivar disable_ip_masking: Disable IP masking. + :vartype disable_ip_masking: bool + :ivar immediate_purge_data_on30_days: Purge data immediately after 30 days. + :vartype immediate_purge_data_on30_days: bool + :ivar workspace_resource_id: Resource Id of the log analytics workspace which the data will be + ingested to. This property is required to create an application with this API version. + Applications from older versions will not have this property. + :vartype workspace_resource_id: str + :ivar la_migration_date: The date which the component got migrated to LA, in ISO 8601 format. + :vartype la_migration_date: ~datetime.datetime + :ivar private_link_scoped_resources: List of linked private link scope resources. + :vartype private_link_scoped_resources: + list[~azure.mgmt.applicationinsights.models.PrivateLinkScopedResource] + :ivar public_network_access_for_ingestion: The network access type for accessing Application + Insights ingestion. Known values are: "Enabled" and "Disabled". + :vartype public_network_access_for_ingestion: str or + ~azure.mgmt.applicationinsights.models.PublicNetworkAccessType + :ivar public_network_access_for_query: The network access type for accessing Application + Insights query. Known values are: "Enabled" and "Disabled". + :vartype public_network_access_for_query: str or + ~azure.mgmt.applicationinsights.models.PublicNetworkAccessType + :ivar ingestion_mode: Indicates the flow of the ingestion. Known values are: + "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". + :vartype ingestion_mode: str or ~azure.mgmt.applicationinsights.models.IngestionMode + :ivar disable_local_auth: Disable Non-AAD based Auth. + :vartype disable_local_auth: bool + :ivar force_customer_storage_for_profiler: Force users to create their own storage account for + profiler and debugger. + :vartype force_customer_storage_for_profiler: bool + """ + + application_id: Optional[str] = rest_field(name="ApplicationId", visibility=["read"]) + """The unique ID of your application. This field mirrors the 'Name' field and cannot be changed.""" + app_id: Optional[str] = rest_field(name="AppId", visibility=["read"]) + """Application Insights Unique ID for your Application.""" + name: Optional[str] = rest_field(name="Name", visibility=["read"]) + """Application name.""" + application_type: Union[str, "_models.ApplicationType"] = rest_field( + name="Application_Type", visibility=["read", "create"] + ) + """Type of application being monitored. Required. Known values are: \"web\" and \"other\".""" + flow_type: Optional[Union[str, "_models.FlowType"]] = rest_field( + name="Flow_Type", visibility=["read", "create", "update", "delete", "query"] + ) + """Used by the Application Insights system to determine what kind of flow this component was + created by. This is to be set to 'Bluefield' when creating/updating a component via the REST + API. \"Bluefield\"""" + request_source: Optional[Union[str, "_models.RequestSource"]] = rest_field( + name="Request_Source", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes what tool created this Application Insights component. Customers using this API + should set this to the default 'rest'. \"rest\"""" + instrumentation_key: Optional[str] = rest_field(name="InstrumentationKey", visibility=["read"]) + """Application Insights Instrumentation key. A read-only value that applications can use to + identify the destination for all telemetry sent to Azure Application Insights. This value will + be supplied upon construction of each new Application Insights component.""" + creation_date: Optional[datetime.datetime] = rest_field(name="CreationDate", visibility=["read"], format="rfc3339") + """Creation Date for the Application Insights component, in ISO 8601 format.""" + tenant_id: Optional[str] = rest_field(name="TenantId", visibility=["read"]) + """Azure Tenant Id.""" + hockey_app_id: Optional[str] = rest_field( + name="HockeyAppId", visibility=["read", "create", "update", "delete", "query"] + ) + """The unique application ID created when a new application is added to HockeyApp, used for + communications with HockeyApp.""" + hockey_app_token: Optional[str] = rest_field(name="HockeyAppToken", visibility=["read"]) + """Token used to authenticate communications with between Application Insights and HockeyApp.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Current state of this component: whether or not is has been provisioned within the resource + group it is defined. Users cannot change this value but are able to read from it. Values will + include Succeeded, Deploying, Canceled, and Failed.""" + sampling_percentage: Optional[float] = rest_field( + name="SamplingPercentage", visibility=["read", "create", "update", "delete", "query"] + ) + """Percentage of the data produced by the application being monitored that is being sampled for + Application Insights telemetry.""" + connection_string: Optional[str] = rest_field(name="ConnectionString", visibility=["read"]) + """Application Insights component connection string.""" + retention_in_days: Optional[int] = rest_field( + name="RetentionInDays", visibility=["read", "create", "update", "delete", "query"] + ) + """Retention period in days.""" + disable_ip_masking: Optional[bool] = rest_field( + name="DisableIpMasking", visibility=["read", "create", "update", "delete", "query"] + ) + """Disable IP masking.""" + immediate_purge_data_on30_days: Optional[bool] = rest_field( + name="ImmediatePurgeDataOn30Days", visibility=["read", "create", "update", "delete", "query"] + ) + """Purge data immediately after 30 days.""" + workspace_resource_id: Optional[str] = rest_field( + name="WorkspaceResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Id of the log analytics workspace which the data will be ingested to. This property is + required to create an application with this API version. Applications from older versions will + not have this property.""" + la_migration_date: Optional[datetime.datetime] = rest_field( + name="LaMigrationDate", visibility=["read"], format="rfc3339" + ) + """The date which the component got migrated to LA, in ISO 8601 format.""" + private_link_scoped_resources: Optional[list["_models.PrivateLinkScopedResource"]] = rest_field( + name="PrivateLinkScopedResources", visibility=["read"] + ) + """List of linked private link scope resources.""" + public_network_access_for_ingestion: Optional[Union[str, "_models.PublicNetworkAccessType"]] = rest_field( + name="publicNetworkAccessForIngestion", visibility=["read", "create", "update", "delete", "query"] + ) + """The network access type for accessing Application Insights ingestion. Known values are: + \"Enabled\" and \"Disabled\".""" + public_network_access_for_query: Optional[Union[str, "_models.PublicNetworkAccessType"]] = rest_field( + name="publicNetworkAccessForQuery", visibility=["read", "create", "update", "delete", "query"] + ) + """The network access type for accessing Application Insights query. Known values are: \"Enabled\" + and \"Disabled\".""" + ingestion_mode: Optional[Union[str, "_models.IngestionMode"]] = rest_field( + name="IngestionMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the flow of the ingestion. Known values are: \"ApplicationInsights\", + \"ApplicationInsightsWithDiagnosticSettings\", and \"LogAnalytics\".""" + disable_local_auth: Optional[bool] = rest_field( + name="DisableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """Disable Non-AAD based Auth.""" + force_customer_storage_for_profiler: Optional[bool] = rest_field( + name="ForceCustomerStorageForProfiler", visibility=["read", "create", "update", "delete", "query"] + ) + """Force users to create their own storage account for profiler and debugger.""" + + @overload + def __init__( + self, + *, + application_type: Union[str, "_models.ApplicationType"], + flow_type: Optional[Union[str, "_models.FlowType"]] = None, + request_source: Optional[Union[str, "_models.RequestSource"]] = None, + hockey_app_id: Optional[str] = None, + sampling_percentage: Optional[float] = None, + retention_in_days: Optional[int] = None, + disable_ip_masking: Optional[bool] = None, + immediate_purge_data_on30_days: Optional[bool] = None, + workspace_resource_id: Optional[str] = None, + public_network_access_for_ingestion: Optional[Union[str, "_models.PublicNetworkAccessType"]] = None, + public_network_access_for_query: Optional[Union[str, "_models.PublicNetworkAccessType"]] = None, + ingestion_mode: Optional[Union[str, "_models.IngestionMode"]] = None, + disable_local_auth: Optional[bool] = None, + force_customer_storage_for_profiler: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationInsightsComponentQuotaStatus(_Model): + """An Application Insights component daily data volume cap status. + + :ivar app_id: The Application ID for the Application Insights component. + :vartype app_id: str + :ivar should_be_throttled: The daily data volume cap is met, and data ingestion will be + stopped. + :vartype should_be_throttled: bool + :ivar expiration_time: Date and time when the daily data volume cap will be reset, and data + ingestion will resume. + :vartype expiration_time: str + """ + + app_id: Optional[str] = rest_field(name="AppId", visibility=["read"]) + """The Application ID for the Application Insights component.""" + should_be_throttled: Optional[bool] = rest_field(name="ShouldBeThrottled", visibility=["read"]) + """The daily data volume cap is met, and data ingestion will be stopped.""" + expiration_time: Optional[str] = rest_field(name="ExpirationTime", visibility=["read"]) + """Date and time when the daily data volume cap will be reset, and data ingestion will resume.""" + + +class ApplicationInsightsComponentWebTestLocation(_Model): # pylint: disable=name-too-long + """Properties that define a web test location available to an Application Insights Component. + + :ivar display_name: The display name of the web test location. + :vartype display_name: str + :ivar tag: Internally defined geographic location tag. + :vartype tag: str + """ + + display_name: Optional[str] = rest_field(name="DisplayName", visibility=["read"]) + """The display name of the web test location.""" + tag: Optional[str] = rest_field(name="Tag", visibility=["read"]) + """Internally defined geographic location tag.""" + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.applicationinsights.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.applicationinsights.models.SystemData + """ + + +class ComponentLinkedStorageAccounts(ProxyResource): + """An Application Insights component linked storage accounts. + + :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.applicationinsights.models.SystemData + :ivar properties: The properties of the linked storage accounts. + :vartype properties: ~azure.mgmt.applicationinsights.models.LinkedStorageAccountsProperties + """ + + properties: Optional["_models.LinkedStorageAccountsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the linked storage accounts.""" + + __flattened_items = ["linked_storage_account"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.LinkedStorageAccountsProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ComponentLinkedStorageAccountsPatch(_Model): + """An Application Insights component linked storage accounts patch. + + :ivar properties: The properties of the linked storage accounts. + :vartype properties: ~azure.mgmt.applicationinsights.models.LinkedStorageAccountsProperties + """ + + properties: Optional["_models.LinkedStorageAccountsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the linked storage accounts.""" + + __flattened_items = ["linked_storage_account"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.LinkedStorageAccountsProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ComponentPurgeBody(_Model): + """Describes the body of a purge request for an App Insights component. + + :ivar table: Table from which to purge data. Required. + :vartype table: str + :ivar filters: The set of columns and filters (queries) to run over them to purge the resulting + data. Required. + :vartype filters: list[~azure.mgmt.applicationinsights.models.ComponentPurgeBodyFilters] + """ + + table: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Table from which to purge data. Required.""" + filters: list["_models.ComponentPurgeBodyFilters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The set of columns and filters (queries) to run over them to purge the resulting data. + Required.""" + + @overload + def __init__( + self, + *, + table: str, + filters: list["_models.ComponentPurgeBodyFilters"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ComponentPurgeBodyFilters(_Model): + """User-defined filters to return data which will be purged from the table. + + :ivar column: The column of the table over which the given query should run. + :vartype column: str + :ivar operator: A query operator to evaluate over the provided column and value(s). Supported + operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would + in a KQL query. + :vartype operator: str + :ivar value: the value for the operator to function over. This can be a number (e.g., > 100), a + string (timestamp >= '2017-09-01') or array of values. + :vartype value: any + :ivar key: When filtering over custom dimensions, this key will be used as the name of the + custom dimension. + :vartype key: str + """ + + column: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The column of the table over which the given query should run.""" + operator: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A query operator to evaluate over the provided column and value(s). Supported operators are ==, + =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would in a KQL query.""" + value: Optional[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """the value for the operator to function over. This can be a number (e.g., > 100), a string + (timestamp >= '2017-09-01') or array of values.""" + key: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """When filtering over custom dimensions, this key will be used as the name of the custom + dimension.""" + + @overload + def __init__( + self, + *, + column: Optional[str] = None, + operator: Optional[str] = None, + value: Optional[Any] = None, + key: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ComponentPurgeResponse(_Model): + """Response containing operationId for a specific purge action. + + :ivar operation_id: Id to use when querying for status for a particular purge operation. + Required. + :vartype operation_id: str + """ + + operation_id: str = rest_field(name="operationId", visibility=["read", "create", "update", "delete", "query"]) + """Id to use when querying for status for a particular purge operation. Required.""" + + @overload + def __init__( + self, + *, + operation_id: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ComponentPurgeStatusResponse(_Model): + """Response containing status for a specific purge operation. + + :ivar status: Status of the operation represented by the requested Id. Required. Known values + are: "pending" and "completed". + :vartype status: str or ~azure.mgmt.applicationinsights.models.PurgeState + """ + + status: Union[str, "_models.PurgeState"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Status of the operation represented by the requested Id. Required. Known values are: + \"pending\" and \"completed\".""" + + @overload + def __init__( + self, + *, + status: Union[str, "_models.PurgeState"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.applicationinsights.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeletedWorkbookResource(TrackedResource): + """An azure resource object. + + :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.applicationinsights.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar kind: The kind of workbook. Only valid value is shared. "shared" + :vartype kind: str or ~azure.mgmt.applicationinsights.models.DeletedWorkbookSharedTypeKind + :ivar etag: Resource etag. + :vartype etag: str + """ + + kind: Optional[Union[str, "_models.DeletedWorkbookSharedTypeKind"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The kind of workbook. Only valid value is shared. \"shared\"""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource etag.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + kind: Optional[Union[str, "_models.DeletedWorkbookSharedTypeKind"]] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeletedWorkbook(DeletedWorkbookResource): + """A workbook definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.applicationinsights.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar kind: The kind of workbook. Only valid value is shared. "shared" + :vartype kind: str or ~azure.mgmt.applicationinsights.models.DeletedWorkbookSharedTypeKind + :ivar etag: Resource etag. + :vartype etag: str + :ivar properties: Metadata describing a workbook for an Azure resource. + :vartype properties: ~azure.mgmt.applicationinsights.models.DeletedWorkbookProperties + """ + + properties: Optional["_models.DeletedWorkbookProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata describing a workbook for an Azure resource.""" + + __flattened_items = [ + "display_name", + "serialized_data", + "version", + "time_modified", + "category", + "tags", + "user_id", + "source_id", + "storage_uri", + "description", + "revision", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + kind: Optional[Union[str, "_models.DeletedWorkbookSharedTypeKind"]] = None, + etag: Optional[str] = None, + properties: Optional["_models.DeletedWorkbookProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class DeletedWorkbookError(_Model): + """Error response. + + :ivar error: The error details. + :vartype error: ~azure.mgmt.applicationinsights.models.DeletedWorkbookErrorDefinition + """ + + error: Optional["_models.DeletedWorkbookErrorDefinition"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The error details.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.DeletedWorkbookErrorDefinition"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DeletedWorkbookErrorDefinition(_Model): + """Error definition. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar innererror: Internal error details. + :vartype innererror: ~azure.mgmt.applicationinsights.models.DeletedWorkbookInnerErrorTrace + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """Service specific error code which serves as the substatus for the HTTP error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """Description of the error.""" + innererror: Optional["_models.DeletedWorkbookInnerErrorTrace"] = rest_field(visibility=["read"]) + """Internal error details.""" + + +class DeletedWorkbookInnerErrorTrace(_Model): + """Error details. + + :ivar trace: detailed error trace. + :vartype trace: list[str] + """ + + trace: Optional[list[str]] = rest_field(visibility=["read"]) + """detailed error trace.""" + + +class DeletedWorkbookProperties(_Model): + """Properties that contain a workbook. + + :ivar display_name: The user-defined name (display name) of the workbook. Required. + :vartype display_name: str + :ivar serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. Required. + :vartype serialized_data: str + :ivar version: Workbook schema version format, like 'Notebook/1.0', which should match the + workbook in serializedData. + :vartype version: str + :ivar time_modified: Date and time in UTC of the last modification that was made to this + workbook definition. + :vartype time_modified: ~datetime.datetime + :ivar category: Workbook category, as defined by the user at creation time. Required. + :vartype category: str + :ivar tags: Being deprecated, please use the other tags field. + :vartype tags: list[str] + :ivar user_id: Unique user id of the specific user that owns this workbook. + :vartype user_id: str + :ivar source_id: ResourceId for a source resource. + :vartype source_id: str + :ivar storage_uri: The resourceId to the storage account when bring your own storage is used. + :vartype storage_uri: str + :ivar description: The description of the workbook. + :vartype description: str + :ivar revision: The unique revision id for this workbook definition. + :vartype revision: str + """ + + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) + """The user-defined name (display name) of the workbook. Required.""" + serialized_data: str = rest_field(name="serializedData", visibility=["read", "create", "update", "delete", "query"]) + """Configuration of this particular workbook. Configuration data is a string containing valid + JSON. Required.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Workbook schema version format, like 'Notebook/1.0', which should match the workbook in + serializedData.""" + time_modified: Optional[datetime.datetime] = rest_field(name="timeModified", visibility=["read"], format="rfc3339") + """Date and time in UTC of the last modification that was made to this workbook definition.""" + category: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Workbook category, as defined by the user at creation time. Required.""" + tags: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Being deprecated, please use the other tags field.""" + user_id: Optional[str] = rest_field(name="userId", visibility=["read"]) + """Unique user id of the specific user that owns this workbook.""" + source_id: Optional[str] = rest_field(name="sourceId", visibility=["read", "create", "update", "delete", "query"]) + """ResourceId for a source resource.""" + storage_uri: Optional[str] = rest_field( + name="storageUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The resourceId to the storage account when bring your own storage is used.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the workbook.""" + revision: Optional[str] = rest_field(visibility=["read"]) + """The unique revision id for this workbook definition.""" + + @overload + def __init__( + self, + *, + display_name: str, + serialized_data: str, + category: str, + version: Optional[str] = None, + tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + storage_uri: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorFieldContract(_Model): + """Error Field contract. + + :ivar code: Property level error code. + :vartype code: str + :ivar message: Human-readable representation of property-level error. + :vartype message: str + :ivar target: Property name. + :vartype target: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Property level error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Human-readable representation of property-level error.""" + target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Property name.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorResponse(_Model): + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + :ivar details: The list of invalid fields send in request, in case of validation error. + :vartype details: list[~azure.mgmt.applicationinsights.models.ErrorFieldContract] + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message indicating why the operation failed.""" + details: Optional[list["_models.ErrorFieldContract"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of invalid fields send in request, in case of validation error.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + details: Optional[list["_models.ErrorFieldContract"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorResponseComponents(_Model): + """ErrorResponseComponents. + + :ivar error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :vartype error: ~azure.mgmt.applicationinsights.models.ErrorResponseComponentsError + """ + + error: Optional["_models.ErrorResponseComponentsError"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorResponseComponentsError"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorResponseComponentsError(_Model): + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """Error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """Error message indicating why the operation failed.""" + + +class ErrorResponseLinkedStorage(_Model): + """ErrorResponseLinkedStorage. + + :ivar error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :vartype error: ~azure.mgmt.applicationinsights.models.ErrorResponseLinkedStorageError + """ + + error: Optional["_models.ErrorResponseLinkedStorageError"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorResponseLinkedStorageError"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorResponseLinkedStorageError(_Model): + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """Error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """Error message indicating why the operation failed.""" + + +class HeaderField(_Model): + """A header to add to the WebTest. + + :ivar header_field_name: The name of the header. + :vartype header_field_name: str + :ivar header_field_value: The value of the header. + :vartype header_field_value: str + """ + + header_field_name: Optional[str] = rest_field( + name="key", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the header.""" + header_field_value: Optional[str] = rest_field( + name="value", visibility=["read", "create", "update", "delete", "query"] + ) + """The value of the header.""" + + @overload + def __init__( + self, + *, + header_field_name: Optional[str] = None, + header_field_value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class InnerError(_Model): + """Inner error. + + :ivar diagnosticcontext: Provides correlation for request. + :vartype diagnosticcontext: str + :ivar time: Request time. + :vartype time: ~datetime.datetime + """ + + diagnosticcontext: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Provides correlation for request.""" + time: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Request time.""" + + @overload + def __init__( + self, + *, + diagnosticcontext: Optional[str] = None, + time: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LinkedStorageAccountsProperties(_Model): + """An Application Insights component linked storage account. + + :ivar linked_storage_account: Linked storage account resource ID. + :vartype linked_storage_account: str + """ + + linked_storage_account: Optional[str] = rest_field( + name="linkedStorageAccount", visibility=["read", "create", "update", "delete", "query"] + ) + """Linked storage account resource ID.""" + + @overload + def __init__( + self, + *, + linked_storage_account: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LiveTokenErrorResponseLinkedStorage(_Model): + """LiveTokenErrorResponseLinkedStorage. + + :ivar error: Error response indicates Insights service is not able to process the incoming + request. The reason is provided in the error message. + :vartype error: ~azure.mgmt.applicationinsights.models.LiveTokenErrorResponseLinkedStorageError + """ + + error: Optional["_models.LiveTokenErrorResponseLinkedStorageError"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.LiveTokenErrorResponseLinkedStorageError"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LiveTokenErrorResponseLinkedStorageError(_Model): + """Error response indicates Insights service is not able to process the incoming request. The + reason is provided in the error message. + + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """Error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """Error message indicating why the operation failed.""" + + +class LiveTokenResponse(_Model): + """The response to a live token query. + + :ivar live_token: JWT token for accessing live metrics stream data. + :vartype live_token: str + """ + + live_token: Optional[str] = rest_field(name="liveToken", visibility=["read"]) + """JWT token for accessing live metrics stream data.""" + + +class ManagedServiceIdentity(_Model): + """Managed service identity (system assigned and/or user assigned identities). + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.applicationinsights.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.applicationinsights.models.UserAssignedIdentity] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The service principal ID of the system assigned identity. This property will only be provided + for a system assigned identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant ID of the system assigned identity. This property will only be provided for a system + assigned identity.""" + type: Union[str, "_models.ManagedServiceIdentityType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of managed identity assigned to this resource. Required. Known values are: \"None\", + \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned,UserAssigned\".""" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The identities assigned to this resource by the user.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Operation(_Model): + """Azure Workbooks REST API operation. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.applicationinsights.models.OperationDisplay + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation name: {provider}/{resource}/{operation}.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The object that represents the operation.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_Model): + """The object that represents the operation. + + :ivar provider: Service provider: Microsoft.Insights. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, delete, etc. + :vartype operation: str + """ + + provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Service provider: Microsoft.Insights.""" + resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource on which the operation is performed: Profile, endpoint, etc.""" + operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation type: Read, write, delete, etc.""" + + @overload + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkScopedResource(_Model): + """The private link scope resource reference. + + :ivar resource_id: The full resource Id of the private link scope resource. + :vartype resource_id: str + :ivar scope_id: The private link scope unique Identifier. + :vartype scope_id: str + """ + + resource_id: Optional[str] = rest_field( + name="ResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The full resource Id of the private link scope resource.""" + scope_id: Optional[str] = rest_field(name="ScopeId", visibility=["read", "create", "update", "delete", "query"]) + """The private link scope unique Identifier.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + scope_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.applicationinsights.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.applicationinsights.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TagsResource(_Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on a + WebTest instance. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserAssignedIdentity(_Model): + """User assigned identity properties. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the assigned identity.""" + + +class WebtestsResource(_Model): + """An azure resource object. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Azure resource Id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """Azure resource name.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Azure resource type.""" + location: str = rest_field(visibility=["read", "create"]) + """Resource location. Required.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebTest(WebtestsResource): + """An Application Insights WebTest definition. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar name: Azure resource name. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar location: Resource location. Required. + :vartype location: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind of WebTest that this web test watches. Choices are ping, multistep and + standard. Known values are: "ping", "multistep", and "standard". + :vartype kind: str or ~azure.mgmt.applicationinsights.models.WebTestKind + :ivar properties: Metadata describing a web test for an Azure resource. + :vartype properties: ~azure.mgmt.applicationinsights.models.WebTestProperties + """ + + kind: Optional[Union[str, "_models.WebTestKind"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The kind of WebTest that this web test watches. Choices are ping, multistep and standard. Known + values are: \"ping\", \"multistep\", and \"standard\".""" + properties: Optional["_models.WebTestProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata describing a web test for an Azure resource.""" + + __flattened_items = [ + "synthetic_monitor_id", + "web_test_name", + "description", + "enabled", + "frequency", + "timeout", + "web_test_kind", + "retry_enabled", + "locations", + "configuration", + "provisioning_state", + "request", + "validation_rules", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + kind: Optional[Union[str, "_models.WebTestKind"]] = None, + properties: Optional["_models.WebTestProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WebTestGeolocation(_Model): + """Geo-physical location to run a WebTest from. You must specify one or more locations for the + test to run from. + + :ivar location: Location ID for the WebTest to run from. + :vartype location: str + """ + + location: Optional[str] = rest_field(name="Id", visibility=["read", "create", "update", "delete", "query"]) + """Location ID for the WebTest to run from.""" + + @overload + def __init__( + self, + *, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebTestProperties(_Model): + """Metadata describing a web test for an Azure resource. + + :ivar synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as the + Name field. Required. + :vartype synthetic_monitor_id: str + :ivar web_test_name: User defined name if this WebTest. Required. + :vartype web_test_name: str + :ivar description: User defined description for this WebTest. + :vartype description: str + :ivar enabled: Is the test actively being monitored. + :vartype enabled: bool + :ivar frequency: Interval in seconds between test runs for this WebTest. Default value is 300. + :vartype frequency: int + :ivar timeout: Seconds until this WebTest will timeout and fail. Default value is 30. + :vartype timeout: int + :ivar web_test_kind: The kind of web test this is, valid choices are ping, multistep and + standard. Required. Known values are: "ping", "multistep", and "standard". + :vartype web_test_kind: str or ~azure.mgmt.applicationinsights.models.WebTestKind + :ivar retry_enabled: Allow for retries should this WebTest fail. + :vartype retry_enabled: bool + :ivar locations: A list of where to physically run the tests from to give global coverage for + accessibility of your application. Required. + :vartype locations: list[~azure.mgmt.applicationinsights.models.WebTestGeolocation] + :ivar configuration: An XML configuration specification for a WebTest. + :vartype configuration: ~azure.mgmt.applicationinsights.models.WebTestPropertiesConfiguration + :ivar provisioning_state: Current state of this component, whether or not is has been + provisioned within the resource group it is defined. Users cannot change this value but are + able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. + :vartype provisioning_state: str + :ivar request: The collection of request properties. + :vartype request: ~azure.mgmt.applicationinsights.models.WebTestPropertiesRequest + :ivar validation_rules: The collection of validation rule properties. + :vartype validation_rules: + ~azure.mgmt.applicationinsights.models.WebTestPropertiesValidationRules + """ + + synthetic_monitor_id: str = rest_field( + name="SyntheticMonitorId", visibility=["read", "create", "update", "delete", "query"] + ) + """Unique ID of this WebTest. This is typically the same value as the Name field. Required.""" + web_test_name: str = rest_field(name="Name", visibility=["read", "create", "update", "delete", "query"]) + """User defined name if this WebTest. Required.""" + description: Optional[str] = rest_field( + name="Description", visibility=["read", "create", "update", "delete", "query"] + ) + """User defined description for this WebTest.""" + enabled: Optional[bool] = rest_field(name="Enabled", visibility=["read", "create", "update", "delete", "query"]) + """Is the test actively being monitored.""" + frequency: Optional[int] = rest_field(name="Frequency", visibility=["read", "create", "update", "delete", "query"]) + """Interval in seconds between test runs for this WebTest. Default value is 300.""" + timeout: Optional[int] = rest_field(name="Timeout", visibility=["read", "create", "update", "delete", "query"]) + """Seconds until this WebTest will timeout and fail. Default value is 30.""" + web_test_kind: Union[str, "_models.WebTestKind"] = rest_field( + name="Kind", visibility=["read", "create", "update", "delete", "query"] + ) + """The kind of web test this is, valid choices are ping, multistep and standard. Required. Known + values are: \"ping\", \"multistep\", and \"standard\".""" + retry_enabled: Optional[bool] = rest_field( + name="RetryEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Allow for retries should this WebTest fail.""" + locations: list["_models.WebTestGeolocation"] = rest_field( + name="Locations", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of where to physically run the tests from to give global coverage for accessibility of + your application. Required.""" + configuration: Optional["_models.WebTestPropertiesConfiguration"] = rest_field( + name="Configuration", visibility=["read", "create", "update", "delete", "query"] + ) + """An XML configuration specification for a WebTest.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Current state of this component, whether or not is has been provisioned within the resource + group it is defined. Users cannot change this value but are able to read from it. Values will + include Succeeded, Deploying, Canceled, and Failed.""" + request: Optional["_models.WebTestPropertiesRequest"] = rest_field( + name="Request", visibility=["read", "create", "update", "delete", "query"] + ) + """The collection of request properties.""" + validation_rules: Optional["_models.WebTestPropertiesValidationRules"] = rest_field( + name="ValidationRules", visibility=["read", "create", "update", "delete", "query"] + ) + """The collection of validation rule properties.""" + + @overload + def __init__( + self, + *, + synthetic_monitor_id: str, + web_test_name: str, + web_test_kind: Union[str, "_models.WebTestKind"], + locations: list["_models.WebTestGeolocation"], + description: Optional[str] = None, + enabled: Optional[bool] = None, + frequency: Optional[int] = None, + timeout: Optional[int] = None, + retry_enabled: Optional[bool] = None, + configuration: Optional["_models.WebTestPropertiesConfiguration"] = None, + request: Optional["_models.WebTestPropertiesRequest"] = None, + validation_rules: Optional["_models.WebTestPropertiesValidationRules"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebTestPropertiesConfiguration(_Model): + """An XML configuration specification for a WebTest. + + :ivar web_test: The XML specification of a WebTest to run against an application. + :vartype web_test: str + """ + + web_test: Optional[str] = rest_field(name="WebTest", visibility=["read", "create", "update", "delete", "query"]) + """The XML specification of a WebTest to run against an application.""" + + @overload + def __init__( + self, + *, + web_test: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebTestPropertiesRequest(_Model): + """The collection of request properties. + + :ivar request_url: Url location to test. + :vartype request_url: str + :ivar headers: List of headers and their values to add to the WebTest call. + :vartype headers: list[~azure.mgmt.applicationinsights.models.HeaderField] + :ivar http_verb: Http verb to use for this web test. + :vartype http_verb: str + :ivar request_body: Base64 encoded string body to send with this web test. + :vartype request_body: str + :ivar parse_dependent_requests: Parse Dependent request for this WebTest. + :vartype parse_dependent_requests: bool + :ivar follow_redirects: Follow redirects for this web test. + :vartype follow_redirects: bool + """ + + request_url: Optional[str] = rest_field( + name="RequestUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """Url location to test.""" + headers: Optional[list["_models.HeaderField"]] = rest_field( + name="Headers", visibility=["read", "create", "update", "delete", "query"] + ) + """List of headers and their values to add to the WebTest call.""" + http_verb: Optional[str] = rest_field(name="HttpVerb", visibility=["read", "create", "update", "delete", "query"]) + """Http verb to use for this web test.""" + request_body: Optional[str] = rest_field( + name="RequestBody", visibility=["read", "create", "update", "delete", "query"] + ) + """Base64 encoded string body to send with this web test.""" + parse_dependent_requests: Optional[bool] = rest_field( + name="ParseDependentRequests", visibility=["read", "create", "update", "delete", "query"] + ) + """Parse Dependent request for this WebTest.""" + follow_redirects: Optional[bool] = rest_field( + name="FollowRedirects", visibility=["read", "create", "update", "delete", "query"] + ) + """Follow redirects for this web test.""" + + @overload + def __init__( + self, + *, + request_url: Optional[str] = None, + headers: Optional[list["_models.HeaderField"]] = None, + http_verb: Optional[str] = None, + request_body: Optional[str] = None, + parse_dependent_requests: Optional[bool] = None, + follow_redirects: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebTestPropertiesValidationRules(_Model): + """The collection of validation rule properties. + + :ivar content_validation: The collection of content validation properties. + :vartype content_validation: + ~azure.mgmt.applicationinsights.models.WebTestPropertiesValidationRulesContentValidation + :ivar ssl_check: Checks to see if the SSL cert is still valid. + :vartype ssl_check: bool + :ivar ssl_cert_remaining_lifetime_check: A number of days to check still remain before the the + existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. + :vartype ssl_cert_remaining_lifetime_check: int + :ivar expected_http_status_code: Validate that the WebTest returns the http status code + provided. + :vartype expected_http_status_code: int + :ivar ignore_http_status_code: When set, validation will ignore the status code. + :vartype ignore_http_status_code: bool + """ + + content_validation: Optional["_models.WebTestPropertiesValidationRulesContentValidation"] = rest_field( + name="ContentValidation", visibility=["read", "create", "update", "delete", "query"] + ) + """The collection of content validation properties.""" + ssl_check: Optional[bool] = rest_field(name="SSLCheck", visibility=["read", "create", "update", "delete", "query"]) + """Checks to see if the SSL cert is still valid.""" + ssl_cert_remaining_lifetime_check: Optional[int] = rest_field( + name="SSLCertRemainingLifetimeCheck", visibility=["read", "create", "update", "delete", "query"] + ) + """A number of days to check still remain before the the existing SSL cert expires. Value must be + positive and the SSLCheck must be set to true.""" + expected_http_status_code: Optional[int] = rest_field( + name="ExpectedHttpStatusCode", visibility=["read", "create", "update", "delete", "query"] + ) + """Validate that the WebTest returns the http status code provided.""" + ignore_http_status_code: Optional[bool] = rest_field( + name="IgnoreHttpStatusCode", visibility=["read", "create", "update", "delete", "query"] + ) + """When set, validation will ignore the status code.""" + + @overload + def __init__( + self, + *, + content_validation: Optional["_models.WebTestPropertiesValidationRulesContentValidation"] = None, + ssl_check: Optional[bool] = None, + ssl_cert_remaining_lifetime_check: Optional[int] = None, + expected_http_status_code: Optional[int] = None, + ignore_http_status_code: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebTestPropertiesValidationRulesContentValidation(_Model): # pylint: disable=name-too-long + """The collection of content validation properties. + + :ivar content_match: Content to look for in the return of the WebTest. Must not be null or + empty. + :vartype content_match: str + :ivar ignore_case: When set, this value makes the ContentMatch validation case insensitive. + :vartype ignore_case: bool + :ivar pass_if_text_found: When true, validation will pass if there is a match for the + ContentMatch string. If false, validation will fail if there is a match. + :vartype pass_if_text_found: bool + """ + + content_match: Optional[str] = rest_field( + name="ContentMatch", visibility=["read", "create", "update", "delete", "query"] + ) + """Content to look for in the return of the WebTest. Must not be null or empty.""" + ignore_case: Optional[bool] = rest_field( + name="IgnoreCase", visibility=["read", "create", "update", "delete", "query"] + ) + """When set, this value makes the ContentMatch validation case insensitive.""" + pass_if_text_found: Optional[bool] = rest_field( + name="PassIfTextFound", visibility=["read", "create", "update", "delete", "query"] + ) + """When true, validation will pass if there is a match for the ContentMatch string. If false, + validation will fail if there is a match.""" + + @overload + def __init__( + self, + *, + content_match: Optional[str] = None, + ignore_case: Optional[bool] = None, + pass_if_text_found: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebTestTagsResource(_Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on a + WebTest instance. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Workbook(TrackedResource): + """A workbook definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.applicationinsights.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Metadata describing a workbook for an Azure resource. + :vartype properties: ~azure.mgmt.applicationinsights.models.WorkbookProperties + :ivar identity: Identity used for BYOS. + :vartype identity: ~azure.mgmt.applicationinsights.models.WorkbookResourceIdentity + :ivar kind: The kind of workbook. Only valid value is shared. "shared" + :vartype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookSharedTypeKind + :ivar etag: Resource etag. + :vartype etag: str + """ + + properties: Optional["_models.WorkbookProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata describing a workbook for an Azure resource.""" + identity: Optional["_models.WorkbookResourceIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identity used for BYOS.""" + kind: Optional[Union[str, "_models.WorkbookSharedTypeKind"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The kind of workbook. Only valid value is shared. \"shared\"""" + etag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource etag.""" + + __flattened_items = [ + "display_name", + "serialized_data", + "version", + "time_modified", + "category", + "tags", + "user_id", + "source_id", + "storage_uri", + "description", + "revision", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.WorkbookProperties"] = None, + identity: Optional["_models.WorkbookResourceIdentity"] = None, + kind: Optional[Union[str, "_models.WorkbookSharedTypeKind"]] = None, + etag: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WorkbookError(_Model): + """Error response. + + :ivar error: The error details. + :vartype error: ~azure.mgmt.applicationinsights.models.WorkbookErrorDefinition + """ + + error: Optional["_models.WorkbookErrorDefinition"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The error details.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.WorkbookErrorDefinition"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbookErrorDefinition(_Model): + """Error definition. + + :ivar code: Service specific error code which serves as the substatus for the HTTP error code. + :vartype code: str + :ivar message: Description of the error. + :vartype message: str + :ivar innererror: Internal error details. + :vartype innererror: ~azure.mgmt.applicationinsights.models.WorkbookInnerErrorTrace + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """Service specific error code which serves as the substatus for the HTTP error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """Description of the error.""" + innererror: Optional["_models.WorkbookInnerErrorTrace"] = rest_field(visibility=["read"]) + """Internal error details.""" + + +class WorkbookInnerErrorTrace(_Model): + """Error details. + + :ivar trace: detailed error trace. + :vartype trace: list[str] + """ + + trace: Optional[list[str]] = rest_field(visibility=["read"]) + """detailed error trace.""" + + +class WorkbookProperties(_Model): + """Properties that contain a workbook. + + :ivar display_name: The user-defined name (display name) of the workbook. Required. + :vartype display_name: str + :ivar serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. Required. + :vartype serialized_data: str + :ivar version: Workbook schema version format, like 'Notebook/1.0', which should match the + workbook in serializedData. + :vartype version: str + :ivar time_modified: Date and time in UTC of the last modification that was made to this + workbook definition. + :vartype time_modified: ~datetime.datetime + :ivar category: Workbook category, as defined by the user at creation time. Required. + :vartype category: str + :ivar tags: Being deprecated, please use the other tags field. + :vartype tags: list[str] + :ivar user_id: Unique user id of the specific user that owns this workbook. + :vartype user_id: str + :ivar source_id: ResourceId for a source resource. + :vartype source_id: str + :ivar storage_uri: The resourceId to the storage account when bring your own storage is used. + :vartype storage_uri: str + :ivar description: The description of the workbook. + :vartype description: str + :ivar revision: The unique revision id for this workbook definition. + :vartype revision: str + """ + + display_name: str = rest_field(name="displayName", visibility=["read", "create", "update", "delete", "query"]) + """The user-defined name (display name) of the workbook. Required.""" + serialized_data: str = rest_field(name="serializedData", visibility=["read", "create", "update", "delete", "query"]) + """Configuration of this particular workbook. Configuration data is a string containing valid + JSON. Required.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Workbook schema version format, like 'Notebook/1.0', which should match the workbook in + serializedData.""" + time_modified: Optional[datetime.datetime] = rest_field(name="timeModified", visibility=["read"], format="rfc3339") + """Date and time in UTC of the last modification that was made to this workbook definition.""" + category: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Workbook category, as defined by the user at creation time. Required.""" + tags: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Being deprecated, please use the other tags field.""" + user_id: Optional[str] = rest_field(name="userId", visibility=["read"]) + """Unique user id of the specific user that owns this workbook.""" + source_id: Optional[str] = rest_field(name="sourceId", visibility=["read", "create", "update", "delete", "query"]) + """ResourceId for a source resource.""" + storage_uri: Optional[str] = rest_field( + name="storageUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The resourceId to the storage account when bring your own storage is used.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the workbook.""" + revision: Optional[str] = rest_field(visibility=["read"]) + """The unique revision id for this workbook definition.""" + + @overload + def __init__( + self, + *, + display_name: str, + serialized_data: str, + category: str, + version: Optional[str] = None, + tags: Optional[list[str]] = None, + source_id: Optional[str] = None, + storage_uri: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbookPropertiesUpdateParameters(_Model): + """Properties that contain a workbook for PATCH operation. + + :ivar display_name: The user-defined name (display name) of the workbook. + :vartype display_name: str + :ivar serialized_data: Configuration of this particular workbook. Configuration data is a + string containing valid JSON. + :vartype serialized_data: str + :ivar category: Workbook category, as defined by the user at creation time. + :vartype category: str + :ivar tags: A list of 0 or more tags that are associated with this workbook definition. + :vartype tags: list[str] + :ivar description: The description of the workbook. + :vartype description: str + :ivar revision: The unique revision id for this workbook definition. + :vartype revision: str + """ + + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """The user-defined name (display name) of the workbook.""" + serialized_data: Optional[str] = rest_field( + name="serializedData", visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration of this particular workbook. Configuration data is a string containing valid + JSON.""" + category: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Workbook category, as defined by the user at creation time.""" + tags: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A list of 0 or more tags that are associated with this workbook definition.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description of the workbook.""" + revision: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unique revision id for this workbook definition.""" + + @overload + def __init__( + self, + *, + display_name: Optional[str] = None, + serialized_data: Optional[str] = None, + category: Optional[str] = None, + tags: Optional[list[str]] = None, + description: Optional[str] = None, + revision: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbookResourceIdentity(ManagedServiceIdentity): + """Identity used for BYOS. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: The type of managed identity assigned to this resource. Required. Known values are: + "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.applicationinsights.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The identities assigned to this resource by the user. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.applicationinsights.models.UserAssignedIdentity] + """ + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbookTemplate(TrackedResource): + """An Application Insights workbook template definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.applicationinsights.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Metadata describing a workbook template for an Azure resource. + :vartype properties: ~azure.mgmt.applicationinsights.models.WorkbookTemplateProperties + """ + + properties: Optional["_models.WorkbookTemplateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata describing a workbook template for an Azure resource.""" + + __flattened_items = ["priority", "author", "template_data", "galleries", "localized"] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.WorkbookTemplateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WorkbookTemplateError(_Model): + """Error message that will indicate why the operation failed. + + :ivar error: Error message object that will indicate why the operation failed. + :vartype error: ~azure.mgmt.applicationinsights.models.WorkbookTemplateErrorBody + """ + + error: Optional["_models.WorkbookTemplateErrorBody"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Error message object that will indicate why the operation failed.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.WorkbookTemplateErrorBody"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbookTemplateErrorBody(_Model): + """Error message body that will indicate why the operation failed. + + :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error + code specified in the response. + :vartype code: str + :ivar message: Human-readable representation of the error. + :vartype message: str + :ivar details: The list of invalid fields send in request, in case of validation error. + :vartype details: + list[~azure.mgmt.applicationinsights.models.WorkbookTemplateErrorFieldContract] + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Service-defined error code. This code serves as a sub-status for the HTTP error code specified + in the response.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Human-readable representation of the error.""" + details: Optional[list["_models.WorkbookTemplateErrorFieldContract"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of invalid fields send in request, in case of validation error.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + details: Optional[list["_models.WorkbookTemplateErrorFieldContract"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbookTemplateErrorFieldContract(_Model): + """Error Field contract. + + :ivar code: Property level error code. + :vartype code: str + :ivar message: Human-readable representation of property-level error. + :vartype message: str + :ivar target: Property name. + :vartype target: str + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Property level error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Human-readable representation of property-level error.""" + target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Property name.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbookTemplateGallery(_Model): + """Gallery information for a workbook template. + + :ivar name: Name of the workbook template in the gallery. + :vartype name: str + :ivar category: Category for the gallery. + :vartype category: str + :ivar type: Type of workbook supported by the workbook template. + :vartype type: str + :ivar order: Order of the template within the gallery. + :vartype order: int + :ivar resource_type: Azure resource type supported by the gallery. + :vartype resource_type: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the workbook template in the gallery.""" + category: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Category for the gallery.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Type of workbook supported by the workbook template.""" + order: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Order of the template within the gallery.""" + resource_type: Optional[str] = rest_field( + name="resourceType", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure resource type supported by the gallery.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + category: Optional[str] = None, + type: Optional[str] = None, + order: Optional[int] = None, + resource_type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbookTemplateLocalizedGallery(_Model): + """Localized template data and gallery information. + + :ivar template_data: Valid JSON object containing workbook template payload. + :vartype template_data: any + :ivar galleries: Workbook galleries supported by the template. + :vartype galleries: list[~azure.mgmt.applicationinsights.models.WorkbookTemplateGallery] + """ + + template_data: Optional[Any] = rest_field( + name="templateData", visibility=["read", "create", "update", "delete", "query"] + ) + """Valid JSON object containing workbook template payload.""" + galleries: Optional[list["_models.WorkbookTemplateGallery"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Workbook galleries supported by the template.""" + + @overload + def __init__( + self, + *, + template_data: Optional[Any] = None, + galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbookTemplateProperties(_Model): + """Properties that contain a workbook template. + + :ivar priority: Priority of the template. Determines which template to open when a workbook + gallery is opened in viewer mode. + :vartype priority: int + :ivar author: Information about the author of the workbook template. + :vartype author: str + :ivar template_data: Valid JSON object containing workbook template payload. Required. + :vartype template_data: any + :ivar galleries: Workbook galleries supported by the template. Required. + :vartype galleries: list[~azure.mgmt.applicationinsights.models.WorkbookTemplateGallery] + :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages + supported by the Azure portal. + :vartype localized: dict[str, + list[~azure.mgmt.applicationinsights.models.WorkbookTemplateLocalizedGallery]] + """ + + priority: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Priority of the template. Determines which template to open when a workbook gallery is opened + in viewer mode.""" + author: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Information about the author of the workbook template.""" + template_data: Any = rest_field(name="templateData", visibility=["read", "create", "update", "delete", "query"]) + """Valid JSON object containing workbook template payload. Required.""" + galleries: list["_models.WorkbookTemplateGallery"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Workbook galleries supported by the template. Required.""" + localized: Optional[dict[str, list["_models.WorkbookTemplateLocalizedGallery"]]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Key value pair of localized gallery. Each key is the locale code of languages supported by the + Azure portal.""" + + @overload + def __init__( + self, + *, + template_data: Any, + galleries: list["_models.WorkbookTemplateGallery"], + priority: Optional[int] = None, + author: Optional[str] = None, + localized: Optional[dict[str, list["_models.WorkbookTemplateLocalizedGallery"]]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkbookTemplateUpdateParameters(_Model): + """The parameters that can be provided when updating workbook template. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Metadata describing a workbook for an Azure resource. + :vartype properties: ~azure.mgmt.applicationinsights.models.WorkbookTemplateProperties + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + properties: Optional["_models.WorkbookTemplateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata describing a workbook for an Azure resource.""" + + __flattened_items = ["priority", "author", "template_data", "galleries", "localized"] + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.WorkbookTemplateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WorkbookUpdateParameters(_Model): + """The parameters that can be provided when updating workbook properties properties. + + :ivar kind: The kind of workbook. Only valid value is shared. "shared" + :vartype kind: str or ~azure.mgmt.applicationinsights.models.WorkbookUpdateSharedTypeKind + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Metadata describing a workbook for an Azure resource. + :vartype properties: ~azure.mgmt.applicationinsights.models.WorkbookPropertiesUpdateParameters + """ + + kind: Optional[Union[str, "_models.WorkbookUpdateSharedTypeKind"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The kind of workbook. Only valid value is shared. \"shared\"""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update"]) + """Resource tags.""" + properties: Optional["_models.WorkbookPropertiesUpdateParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata describing a workbook for an Azure resource.""" + + __flattened_items = ["display_name", "serialized_data", "category", "tags", "description", "revision"] + + @overload + def __init__( + self, + *, + kind: Optional[Union[str, "_models.WorkbookUpdateSharedTypeKind"]] = None, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.WorkbookPropertiesUpdateParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WorkItemConfiguration(_Model): + """Work item configuration associated with an application insights resource. + + :ivar connector_id: Connector identifier where work item is created. + :vartype connector_id: str + :ivar config_display_name: Configuration friendly name. + :vartype config_display_name: str + :ivar is_default: Boolean value indicating whether configuration is default. + :vartype is_default: bool + :ivar id: Unique Id for work item. + :vartype id: str + :ivar config_properties: Serialized JSON object for detailed properties. + :vartype config_properties: str + """ + + connector_id: Optional[str] = rest_field( + name="ConnectorId", visibility=["read", "create", "update", "delete", "query"] + ) + """Connector identifier where work item is created.""" + config_display_name: Optional[str] = rest_field( + name="ConfigDisplayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Configuration friendly name.""" + is_default: Optional[bool] = rest_field( + name="IsDefault", visibility=["read", "create", "update", "delete", "query"] + ) + """Boolean value indicating whether configuration is default.""" + id: Optional[str] = rest_field(name="Id", visibility=["read", "create", "update", "delete", "query"]) + """Unique Id for work item.""" + config_properties: Optional[str] = rest_field( + name="ConfigProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Serialized JSON object for detailed properties.""" + + @overload + def __init__( + self, + *, + connector_id: Optional[str] = None, + config_display_name: Optional[str] = None, + is_default: Optional[bool] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + config_properties: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkItemConfigurationError(_Model): + """Error associated with trying to get work item configuration or configurations. + + :ivar code: Error detail code and explanation. + :vartype code: str + :ivar message: Error message. + :vartype message: str + :ivar innererror: Inner error. + :vartype innererror: ~azure.mgmt.applicationinsights.models.InnerError + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error detail code and explanation.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Error message.""" + innererror: Optional["_models.InnerError"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Inner error.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + innererror: Optional["_models.InnerError"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WorkItemCreateConfiguration(_Model): + """Work item configuration creation payload. + + :ivar connector_id: Unique connector id. + :vartype connector_id: str + :ivar connector_data_configuration: Serialized JSON object for detailed properties. + :vartype connector_data_configuration: str + :ivar validate_only: Boolean indicating validate only. + :vartype validate_only: bool + :ivar work_item_properties: Custom work item properties. + :vartype work_item_properties: dict[str, str] + """ + + connector_id: Optional[str] = rest_field( + name="ConnectorId", visibility=["read", "create", "update", "delete", "query"] + ) + """Unique connector id.""" + connector_data_configuration: Optional[str] = rest_field( + name="ConnectorDataConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Serialized JSON object for detailed properties.""" + validate_only: Optional[bool] = rest_field( + name="ValidateOnly", visibility=["read", "create", "update", "delete", "query"] + ) + """Boolean indicating validate only.""" + work_item_properties: Optional[dict[str, str]] = rest_field( + name="WorkItemProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Custom work item properties.""" + + @overload + def __init__( + self, + *, + connector_id: Optional[str] = None, + connector_data_configuration: Optional[str] = None, + validate_only: Optional[bool] = None, + work_item_properties: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_patch.py similarity index 100% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_patch.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/models/_patch.py diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py new file mode 100644 index 000000000000..6fc765ebbf13 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/__init__.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import WebTestsOperations # type: ignore +from ._operations import Operations # type: ignore +from ._operations import WorkbooksOperations # type: ignore +from ._operations import WorkbookTemplatesOperations # type: ignore +from ._operations import AnalyticsItemsOperations # type: ignore +from ._operations import AnnotationsOperations # type: ignore +from ._operations import APIKeysOperations # type: ignore +from ._operations import ExportConfigurationsOperations # type: ignore +from ._operations import ComponentCurrentBillingFeaturesOperations # type: ignore +from ._operations import ComponentQuotaStatusOperations # type: ignore +from ._operations import ComponentFeatureCapabilitiesOperations # type: ignore +from ._operations import ComponentAvailableFeaturesOperations # type: ignore +from ._operations import ProactiveDetectionConfigurationsOperations # type: ignore +from ._operations import WorkItemConfigurationsOperations # type: ignore +from ._operations import ComponentLinkedStorageAccountsOperations # type: ignore +from ._operations import ComponentsOperations # type: ignore +from ._operations import DeletedWorkbooksOperations # type: ignore +from ._operations import FavoritesOperations # type: ignore +from ._operations import LiveTokenOperations # type: ignore +from ._operations import webTestLocationsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "WebTestsOperations", + "Operations", + "WorkbooksOperations", + "WorkbookTemplatesOperations", + "AnalyticsItemsOperations", + "AnnotationsOperations", + "APIKeysOperations", + "ExportConfigurationsOperations", + "ComponentCurrentBillingFeaturesOperations", + "ComponentQuotaStatusOperations", + "ComponentFeatureCapabilitiesOperations", + "ComponentAvailableFeaturesOperations", + "ProactiveDetectionConfigurationsOperations", + "WorkItemConfigurationsOperations", + "ComponentLinkedStorageAccountsOperations", + "ComponentsOperations", + "DeletedWorkbooksOperations", + "FavoritesOperations", + "LiveTokenOperations", + "webTestLocationsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_operations.py new file mode 100644 index 000000000000..888768e3e34f --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_operations.py @@ -0,0 +1,10559 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import ApplicationInsightsManagementClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer + +JSON = MutableMapping[str, Any] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_web_tests_get_request( + resource_group_name: str, web_test_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", "2022-06-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "webTestName": _SERIALIZER.url("web_test_name", web_test_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_web_tests_create_or_update_request( + resource_group_name: str, web_test_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", "2022-06-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_web_tests_update_tags_request( + resource_group_name: str, web_test_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", "2022-06-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_web_tests_delete_request( + resource_group_name: str, web_test_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_web_tests_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_web_tests_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_web_tests_list_by_component_request( # pylint: disable=name-too-long + resource_group_name: str, component_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{componentName}/webtests" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "componentName": _SERIALIZER.url("component_name", component_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_operations_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Insights/operations" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbooks_get_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbooks_create_or_update_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + source_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if source_id is not None: + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbooks_update_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + source_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if source_id is not None: + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbooks_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_workbooks_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/workbooks" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbooks_revisions_list_request( + resource_group_name: str, 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-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbooks_revision_get_request( + resource_group_name: str, resource_name: str, revision_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-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions/{revisionId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "revisionId": _SERIALIZER.url("revision_id", revision_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbooks_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + source_id: Optional[str] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks" + 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") + _params["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + if source_id is not None: + _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbook_templates_get_request( + resource_group_name: str, 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", "2020-11-20")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbook_templates_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2020-11-20")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbook_templates_update_request( + resource_group_name: str, 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", "2020-11-20")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_workbook_templates_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_workbook_templates_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_analytics_items_list_request( + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + subscription_id: str, + *, + scope: Optional[Union[str, _models.ItemScope]] = None, + type: Optional[Union[str, _models.ItemTypeParameter]] = None, + include_content: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if scope is not None: + _params["scope"] = _SERIALIZER.query("scope", scope, "str") + if type is not None: + _params["type"] = _SERIALIZER.query("type", type, "str") + if include_content is not None: + _params["includeContent"] = _SERIALIZER.query("include_content", include_content, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_analytics_items_get_request( + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + subscription_id: str, + *, + id: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if id is not None: + _params["id"] = _SERIALIZER.query("id", id, "str") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_analytics_items_put_request( + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + subscription_id: str, + *, + override_item: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if override_item is not None: + _params["overrideItem"] = _SERIALIZER.query("override_item", override_item, "bool") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_analytics_items_delete_request( + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + subscription_id: str, + *, + id: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if id is not None: + _params["id"] = _SERIALIZER.query("id", id, "str") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_annotations_list_request( + resource_group_name: str, resource_name: str, subscription_id: str, *, start: str, end: 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + _params["start"] = _SERIALIZER.query("start", start, "str") + _params["end"] = _SERIALIZER.query("end", end, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_annotations_create_request( + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_annotations_delete_request( + resource_group_name: str, resource_name: str, annotation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "annotationId": _SERIALIZER.url("annotation_id", annotation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_annotations_get_request( + resource_group_name: str, resource_name: str, annotation_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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "annotationId": _SERIALIZER.url("annotation_id", annotation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_api_keys_list_request( + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_api_keys_create_request( + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_api_keys_delete_request( + resource_group_name: str, resource_name: str, key_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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "keyId": _SERIALIZER.url("key_id", key_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_api_keys_get_request( + resource_group_name: str, resource_name: str, key_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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "keyId": _SERIALIZER.url("key_id", key_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_export_configurations_list_request( + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_export_configurations_create_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_export_configurations_delete_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, export_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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "exportId": _SERIALIZER.url("export_id", export_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_export_configurations_get_request( + resource_group_name: str, resource_name: str, export_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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "exportId": _SERIALIZER.url("export_id", export_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_export_configurations_update_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, export_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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "exportId": _SERIALIZER.url("export_id", export_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_component_current_billing_features_get_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_component_current_billing_features_update_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_component_quota_status_get_request( + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/quotastatus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_component_feature_capabilities_get_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/featurecapabilities" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_component_available_features_get_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/getavailablebillingfeatures" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_proactive_detection_configurations_list_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_proactive_detection_configurations_get_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, configuration_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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_proactive_detection_configurations_update_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, configuration_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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_work_item_configurations_list_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_work_item_configurations_create_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_work_item_configurations_get_default_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/DefaultWorkItemConfig" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_work_item_configurations_delete_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, work_item_config_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "workItemConfigId": _SERIALIZER.url("work_item_config_id", work_item_config_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_work_item_configurations_get_item_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, work_item_config_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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "workItemConfigId": _SERIALIZER.url("work_item_config_id", work_item_config_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_work_item_configurations_update_item_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, work_item_config_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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "workItemConfigId": _SERIALIZER.url("work_item_config_id", work_item_config_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_component_linked_storage_accounts_get_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + 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", "2020-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "storageType": _SERIALIZER.url("storage_type", storage_type, "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_component_linked_storage_accounts_create_and_update_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + 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", "2020-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_component_linked_storage_accounts_update_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + 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", "2020-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_component_linked_storage_accounts_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/linkedStorageAccounts/{storageType}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_components_get_request( + resource_group_name: str, 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", "2020-02-02")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_components_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, 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", "2020-02-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_components_update_tags_request( + resource_group_name: str, 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", "2020-02-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_components_delete_request( + resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_components_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_components_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_components_purge_request( + resource_group_name: str, 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", "2020-02-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_components_get_purge_status_request( # pylint: disable=name-too-long + resource_group_name: str, resource_name: str, purge_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", "2020-02-02")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deleted_workbooks_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, + *, + category: Optional[Union[str, _models.DeletedWorkbookCategoryType]] = None, + tags: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/deletedWorkbooks" + 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 category is not None: + _params["category"] = _SERIALIZER.query("category", category, "str") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_favorites_list_request( + resource_group_name: str, + resource_name: str, + subscription_id: str, + *, + favorite_type: Optional[Union[str, _models.FavoriteType]] = None, + source_type: Optional[Union[str, _models.FavoriteSourceType]] = None, + can_fetch_content: Optional[bool] = None, + tags: Optional[List[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-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if favorite_type is not None: + _params["favoriteType"] = _SERIALIZER.query("favorite_type", favorite_type, "str") + if source_type is not None: + _params["sourceType"] = _SERIALIZER.query("source_type", source_type, "str") + if can_fetch_content is not None: + _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") + if tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_favorites_get_request( + resource_group_name: str, resource_name: str, favorite_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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_favorites_add_request( + resource_group_name: str, resource_name: str, favorite_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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_favorites_update_request( + resource_group_name: str, resource_name: str, favorite_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", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_favorites_delete_request( + resource_group_name: str, resource_name: str, favorite_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}" + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_live_token_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-10-14")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/{resourceUri}/providers/Microsoft.Insights/generatelivetoken" + 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") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_web_test_locations_list_request( + resource_group_name: str, 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", "2015-05-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/syntheticmonitorlocations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class WebTestsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`web_tests` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: + """Get a specific Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + _request = build_web_tests_get_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WebTest, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: _models.WebTest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.models.WebTest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Required. + :type web_test_definition: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + web_test_name: str, + web_test_definition: Union[_models.WebTest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Creates or updates an Application Insights web test definition. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_definition: Properties that need to be specified to create or update an + Application Insights web test definition. Is one of the following types: WebTest, JSON, + IO[bytes] Required. + :type web_test_definition: ~azure.mgmt.applicationinsights.models.WebTest or JSON or IO[bytes] + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(web_test_definition, (IOBase, bytes)): + _content = web_test_definition + else: + _content = json.dumps(web_test_definition, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_web_tests_create_or_update_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WebTest, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: _models.WebTestTagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Updates the tags associated with an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to associate with the web test resource. + Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.models.WebTestTagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Updates the tags associated with an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to associate with the web test resource. + Required. + :type web_test_tags: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WebTest: + """Updates the tags associated with an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to associate with the web test resource. + Required. + :type web_test_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + web_test_name: str, + web_test_tags: Union[_models.WebTestTagsResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.WebTest: + """Updates the tags associated with an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :param web_test_tags: Updated tag information to associate with the web test resource. Is one + of the following types: WebTestTagsResource, JSON, IO[bytes] Required. + :type web_test_tags: ~azure.mgmt.applicationinsights.models.WebTestTagsResource or JSON or + IO[bytes] + :return: WebTest. The WebTest is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WebTest + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(web_test_tags, (IOBase, bytes)): + _content = web_test_tags + else: + _content = json.dumps(web_test_tags, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_web_tests_update_tags_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WebTest, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, web_test_name: str, **kwargs: Any + ) -> None: + """Deletes an Application Insights web test. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param web_test_name: The name of the Application Insights WebTest resource. Required. + :type web_test_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_web_tests_delete_request( + resource_group_name=resource_group_name, + web_test_name=web_test_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined for the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of WebTest + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :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", "2022-06-15")) + cls: ClsType[List[_models.WebTest]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_web_tests_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.WebTest], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.WebTest"]: + """Get all Application Insights web test definitions for the specified subscription. + + :return: An iterator like instance of WebTest + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :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", "2022-06-15")) + cls: ClsType[List[_models.WebTest]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_web_tests_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.WebTest], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_component( + self, resource_group_name: str, component_name: str, **kwargs: Any + ) -> ItemPaged["_models.WebTest"]: + """Get all Application Insights web tests defined for the specified component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param component_name: The name of the Application Insights component resource. Required. + :type component_name: str + :return: An iterator like instance of WebTest + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.WebTest] + :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", "2022-06-15")) + cls: ClsType[List[_models.WebTest]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_web_tests_list_by_component_request( + resource_group_name=resource_group_name, + component_name=component_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.WebTest], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class WorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`workbooks` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, *, can_fetch_content: Optional[bool] = None, **kwargs: Any + ) -> _models.Workbook: + """Get a single workbook by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :keyword can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :paramtype can_fetch_content: bool + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_workbooks_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workbook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: _models.Workbook, + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.models.Workbook + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: JSON, + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: JSON + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: IO[bytes], + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. + Required. + :type workbook_properties: IO[bytes] + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_properties: Union[_models.Workbook, JSON, IO[bytes]], + *, + source_id: Optional[str] = None, + **kwargs: Any + ) -> _models.Workbook: + """Create a new workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_properties: Properties that need to be specified to create a new workbook. Is + one of the following types: Workbook, JSON, IO[bytes] Required. + :type workbook_properties: ~azure.mgmt.applicationinsights.models.Workbook or JSON or IO[bytes] + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(workbook_properties, (IOBase, bytes)): + _content = workbook_properties + else: + _content = json.dumps(workbook_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_workbooks_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workbook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.models.WorkbookUpdateParameters + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_update_parameters: Optional[JSON] = None, + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: JSON + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_update_parameters: Optional[IO[bytes]] = None, + *, + source_id: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Default value is None. + :type workbook_update_parameters: IO[bytes] + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, JSON, IO[bytes]]] = None, + *, + source_id: Optional[str] = None, + **kwargs: Any + ) -> _models.Workbook: + """Updates a workbook that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param workbook_update_parameters: Properties that need to be specified to create a new + workbook. Is one of the following types: WorkbookUpdateParameters, JSON, IO[bytes] Default + value is None. + :type workbook_update_parameters: + ~azure.mgmt.applicationinsights.models.WorkbookUpdateParameters or JSON or IO[bytes] + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_update_parameters else None + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if workbook_update_parameters else None + _content = None + if isinstance(workbook_update_parameters, (IOBase, bytes)): + _content = workbook_update_parameters + else: + if workbook_update_parameters is not None: + _content = json.dumps(workbook_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_workbooks_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + source_id=source_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workbook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Delete a workbook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_workbooks_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_subscription( + self, + *, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified subscription and category. + + :keyword category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :paramtype category: str or ~azure.mgmt.applicationinsights.models.CategoryType + :keyword tags: Tags presents on each workbook returned. Default value is None. + :paramtype tags: list[str] + :keyword can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :paramtype can_fetch_content: bool + :return: An iterator like instance of Workbook + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + :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", "2023-06-01")) + cls: ClsType[List[_models.Workbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_workbooks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Workbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def revisions_list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> ItemPaged["_models.Workbook"]: + """Get the revisions for the workbook defined by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :return: An iterator like instance of Workbook + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + :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", "2023-06-01")) + cls: ClsType[List[_models.Workbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_workbooks_revisions_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Workbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def revision_get( + self, resource_group_name: str, resource_name: str, revision_id: str, **kwargs: Any + ) -> _models.Workbook: + """Get a single workbook revision defined by its revisionId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the workbook resource. The value must be an UUID. Required. + :type resource_name: str + :param revision_id: The id of the workbook's revision. Required. + :type revision_id: str + :return: Workbook. The Workbook is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.Workbook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01")) + cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) + + _request = build_workbooks_revision_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + revision_id=revision_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Workbook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + *, + category: Union[str, _models.CategoryType], + tags: Optional[List[str]] = None, + source_id: Optional[str] = None, + can_fetch_content: Optional[bool] = None, + **kwargs: Any + ) -> ItemPaged["_models.Workbook"]: + """Get all Workbooks defined within a specified resource group and category. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Required. + :paramtype category: str or ~azure.mgmt.applicationinsights.models.CategoryType + :keyword tags: Tags presents on each workbook returned. Default value is None. + :paramtype tags: list[str] + :keyword source_id: Azure Resource Id that will fetch all linked workbooks. Default value is + None. + :paramtype source_id: str + :keyword can_fetch_content: Flag indicating whether or not to return the full content for each + applicable workbook. If false, only return summary content for workbooks. Default value is + None. + :paramtype can_fetch_content: bool + :return: An iterator like instance of Workbook + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.Workbook] + :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", "2023-06-01")) + cls: ClsType[List[_models.Workbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_workbooks_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + source_id=source_id, + can_fetch_content=can_fetch_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Workbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class WorkbookTemplatesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`workbook_templates` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.WorkbookTemplate: + """Get a single workbook template by its resourceName. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + _request = build_workbook_templates_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookTemplateError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkbookTemplate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: _models.WorkbookTemplate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Required. + :type workbook_template_properties: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Required. + :type workbook_template_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Required. + :type workbook_template_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_properties: Union[_models.WorkbookTemplate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Create a new workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_properties: Properties that need to be specified to create a new + workbook. Is one of the following types: WorkbookTemplate, JSON, IO[bytes] Required. + :type workbook_template_properties: ~azure.mgmt.applicationinsights.models.WorkbookTemplate or + JSON or IO[bytes] + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(workbook_template_properties, (IOBase, bytes)): + _content = workbook_template_properties + else: + _content = json.dumps(workbook_template_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_workbook_templates_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookTemplateError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkbookTemplate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[_models.WorkbookTemplateUpdateParameters] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Default value is None. + :type workbook_template_update_parameters: + ~azure.mgmt.applicationinsights.models.WorkbookTemplateUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[JSON] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Default value is None. + :type workbook_template_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Default value is None. + :type workbook_template_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + workbook_template_update_parameters: Optional[ + Union[_models.WorkbookTemplateUpdateParameters, JSON, IO[bytes]] + ] = None, + **kwargs: Any + ) -> _models.WorkbookTemplate: + """Updates a workbook template that has already been added. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param workbook_template_update_parameters: Properties that need to be specified to patch a + workbook template. Is one of the following types: WorkbookTemplateUpdateParameters, JSON, + IO[bytes] Default value is None. + :type workbook_template_update_parameters: + ~azure.mgmt.applicationinsights.models.WorkbookTemplateUpdateParameters or JSON or IO[bytes] + :return: WorkbookTemplate. The WorkbookTemplate is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkbookTemplate + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + content_type = content_type if workbook_template_update_parameters else None + cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" if workbook_template_update_parameters else None + _content = None + if isinstance(workbook_template_update_parameters, (IOBase, bytes)): + _content = workbook_template_update_parameters + else: + if workbook_template_update_parameters is not None: + _content = json.dumps(workbook_template_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + else: + _content = None + + _request = build_workbook_templates_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookTemplateError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkbookTemplate, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Delete a workbook template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_workbook_templates_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookTemplateError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.WorkbookTemplate"]: + """Get all Workbook templates defined within a specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of WorkbookTemplate + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.WorkbookTemplate] + :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", "2020-11-20")) + cls: ClsType[List[_models.WorkbookTemplate]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_workbook_templates_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.WorkbookTemplate], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkbookTemplateError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class AnalyticsItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`analytics_items` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + *, + scope: Optional[Union[str, _models.ItemScope]] = None, + type: Optional[Union[str, _models.ItemTypeParameter]] = None, + include_content: Optional[bool] = None, + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentAnalyticsItem]: + """Gets a list of Analytics Items defined within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :keyword scope: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "shared" and "user". Default value is None. + :paramtype scope: str or ~azure.mgmt.applicationinsights.models.ItemScope + :keyword type: Enum indicating the type of the Analytics item. Known values are: "none", + "query", "function", "folder", and "recent". Default value is None. + :paramtype type: str or ~azure.mgmt.applicationinsights.models.ItemTypeParameter + :keyword include_content: Flag indicating whether or not to return the content of each + applicable item. If false, only return the item information. Default value is None. + :paramtype include_content: bool + :return: list of ApplicationInsightsComponentAnalyticsItem + :rtype: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentAnalyticsItem]] = kwargs.pop("cls", None) + + _request = build_analytics_items_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + scope_path=scope_path, + subscription_id=self._config.subscription_id, + scope=scope, + type=type, + include_content=include_content, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.ApplicationInsightsComponentAnalyticsItem], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + *, + id: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAnalyticsItem: + """Gets a specific Analytics Items defined within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :keyword id: The Id of a specific item defined in the Application Insights component. Default + value is None. + :paramtype id: str + :keyword name: The name of a specific item defined in the Application Insights component. + Default value is None. + :paramtype name: str + :return: ApplicationInsightsComponentAnalyticsItem. The + ApplicationInsightsComponentAnalyticsItem is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) + + _request = build_analytics_items_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + scope_path=scope_path, + subscription_id=self._config.subscription_id, + id=id, + name=name, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAnalyticsItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def put( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + item_properties: _models.ApplicationInsightsComponentAnalyticsItem, + *, + override_item: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAnalyticsItem: + """Adds or Updates a specific Analytics Item within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :param item_properties: Properties that need to be specified to create a new item and add it to + an Application Insights component. Required. + :type item_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :keyword override_item: Flag indicating whether or not to force save an item. This allows + overriding an item if it already exists. Default value is None. + :paramtype override_item: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAnalyticsItem. The + ApplicationInsightsComponentAnalyticsItem is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + item_properties: JSON, + *, + override_item: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAnalyticsItem: + """Adds or Updates a specific Analytics Item within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :param item_properties: Properties that need to be specified to create a new item and add it to + an Application Insights component. Required. + :type item_properties: JSON + :keyword override_item: Flag indicating whether or not to force save an item. This allows + overriding an item if it already exists. Default value is None. + :paramtype override_item: bool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAnalyticsItem. The + ApplicationInsightsComponentAnalyticsItem is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def put( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + item_properties: IO[bytes], + *, + override_item: Optional[bool] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAnalyticsItem: + """Adds or Updates a specific Analytics Item within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :param item_properties: Properties that need to be specified to create a new item and add it to + an Application Insights component. Required. + :type item_properties: IO[bytes] + :keyword override_item: Flag indicating whether or not to force save an item. This allows + overriding an item if it already exists. Default value is None. + :paramtype override_item: bool + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAnalyticsItem. The + ApplicationInsightsComponentAnalyticsItem is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def put( + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + item_properties: Union[_models.ApplicationInsightsComponentAnalyticsItem, JSON, IO[bytes]], + *, + override_item: Optional[bool] = None, + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAnalyticsItem: + """Adds or Updates a specific Analytics Item within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :param item_properties: Properties that need to be specified to create a new item and add it to + an Application Insights component. Is one of the following types: + ApplicationInsightsComponentAnalyticsItem, JSON, IO[bytes] Required. + :type item_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem or JSON or + IO[bytes] + :keyword override_item: Flag indicating whether or not to force save an item. This allows + overriding an item if it already exists. Default value is None. + :paramtype override_item: bool + :return: ApplicationInsightsComponentAnalyticsItem. The + ApplicationInsightsComponentAnalyticsItem is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(item_properties, (IOBase, bytes)): + _content = item_properties + else: + _content = json.dumps(item_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_analytics_items_put_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + scope_path=scope_path, + subscription_id=self._config.subscription_id, + override_item=override_item, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAnalyticsItem, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + resource_name: str, + scope_path: Union[str, _models.ItemScopePath], + *, + id: Optional[str] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """Deletes a specific Analytics Items defined within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param scope_path: Enum indicating if this item definition is owned by a specific user or is + shared between all users with access to the Application Insights component. Known values are: + "analyticsItems" and "myanalyticsItems". Required. + :type scope_path: str or ~azure.mgmt.applicationinsights.models.ItemScopePath + :keyword id: The Id of a specific item defined in the Application Insights component. Default + value is None. + :paramtype id: str + :keyword name: The name of a specific item defined in the Application Insights component. + Default value is None. + :paramtype name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_analytics_items_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + scope_path=scope_path, + subscription_id=self._config.subscription_id, + id=id, + name=name, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class AnnotationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`annotations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, *, start: str, end: str, **kwargs: Any + ) -> ItemPaged["_models.Annotation"]: + """Gets the list of annotations for a component for given time range. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :keyword start: The start time to query from for annotations, cannot be older than 90 days from + current date. Required. + :paramtype start: str + :keyword end: The end time to query for annotations. Required. + :paramtype end: str + :return: An iterator like instance of Annotation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.Annotation] + :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", "2015-05-01")) + cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_annotations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + start=start, + end=end, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Annotation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.AnnotationError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + annotation_properties: _models.Annotation, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.Annotation]: + """Create an Annotation of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_properties: Properties that need to be specified to create an annotation of a + Application Insights component. Required. + :type annotation_properties: ~azure.mgmt.applicationinsights.models.Annotation + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of Annotation + :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + annotation_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.Annotation]: + """Create an Annotation of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_properties: Properties that need to be specified to create an annotation of a + Application Insights component. Required. + :type annotation_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of Annotation + :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + annotation_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.Annotation]: + """Create an Annotation of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_properties: Properties that need to be specified to create an annotation of a + Application Insights component. Required. + :type annotation_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: list of Annotation + :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + annotation_properties: Union[_models.Annotation, JSON, IO[bytes]], + **kwargs: Any + ) -> List[_models.Annotation]: + """Create an Annotation of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_properties: Properties that need to be specified to create an annotation of a + Application Insights component. Is one of the following types: Annotation, JSON, IO[bytes] + Required. + :type annotation_properties: ~azure.mgmt.applicationinsights.models.Annotation or JSON or + IO[bytes] + :return: list of Annotation + :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(annotation_properties, (IOBase, bytes)): + _content = annotation_properties + else: + _content = json.dumps(annotation_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_annotations_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.AnnotationError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.Annotation], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, annotation_id: str, **kwargs: Any + ) -> None: + """Delete an Annotation of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_id: The unique annotation ID. This is unique within a Application Insights + component. Required. + :type annotation_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_annotations_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + annotation_id=annotation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, annotation_id: str, **kwargs: Any + ) -> List[_models.Annotation]: + """Get the annotation for given id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param annotation_id: The unique annotation ID. This is unique within a Application Insights + component. Required. + :type annotation_id: str + :return: list of Annotation + :rtype: list[~azure.mgmt.applicationinsights.models.Annotation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) + + _request = build_annotations_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + annotation_id=annotation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.AnnotationError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.Annotation], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class APIKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`api_keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> ItemPaged["_models.ApplicationInsightsComponentAPIKey"]: + """Gets a list of API keys of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: An iterator like instance of ApplicationInsightsComponentAPIKey + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey] + :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", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentAPIKey]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_api_keys_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ApplicationInsightsComponentAPIKey], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + api_key_properties: _models.APIKeyRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Create an API Key of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param api_key_properties: Properties that need to be specified to create an API Key of an + Application Insights component. Required. + :type api_key_properties: ~azure.mgmt.applicationinsights.models.APIKeyRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + api_key_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Create an API Key of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param api_key_properties: Properties that need to be specified to create an API Key of an + Application Insights component. Required. + :type api_key_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + api_key_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Create an API Key of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param api_key_properties: Properties that need to be specified to create an API Key of an + Application Insights component. Required. + :type api_key_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + api_key_properties: Union[_models.APIKeyRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Create an API Key of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param api_key_properties: Properties that need to be specified to create an API Key of an + Application Insights component. Is one of the following types: APIKeyRequest, JSON, IO[bytes] + Required. + :type api_key_properties: ~azure.mgmt.applicationinsights.models.APIKeyRequest or JSON or + IO[bytes] + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(api_key_properties, (IOBase, bytes)): + _content = api_key_properties + else: + _content = json.dumps(api_key_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_api_keys_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAPIKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( + self, resource_group_name: str, resource_name: str, key_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Delete an API Key of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param key_id: The API Key ID. This is unique within a Application Insights component. + Required. + :type key_id: str + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) + + _request = build_api_keys_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + key_id=key_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAPIKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, key_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentAPIKey: + """Get the API Key for this key id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param key_id: The API Key ID. This is unique within a Application Insights component. + Required. + :type key_id: str + :return: ApplicationInsightsComponentAPIKey. The ApplicationInsightsComponentAPIKey is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAPIKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) + + _request = build_api_keys_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + key_id=key_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAPIKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ExportConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`export_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: + """Gets a list of Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: list of ApplicationInsightsComponentExportConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) + + _request = build_export_configurations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.ApplicationInsightsComponentExportConfiguration], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + export_properties: _models.ApplicationInsightsComponentExportRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: + """Create a Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_properties: The request body. Required. + :type export_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of ApplicationInsightsComponentExportConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + export_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: + """Create a Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_properties: The request body. Required. + :type export_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: list of ApplicationInsightsComponentExportConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + export_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: + """Create a Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_properties: The request body. Required. + :type export_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: list of ApplicationInsightsComponentExportConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + export_properties: Union[_models.ApplicationInsightsComponentExportRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: + """Create a Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_properties: The request body. Is one of the following types: + ApplicationInsightsComponentExportRequest, JSON, IO[bytes] Required. + :type export_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest or JSON or + IO[bytes] + :return: list of ApplicationInsightsComponentExportConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(export_properties, (IOBase, bytes)): + _content = export_properties + else: + _content = json.dumps(export_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_export_configurations_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.ApplicationInsightsComponentExportConfiguration], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( + self, resource_group_name: str, resource_name: str, export_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Delete a Continuous Export configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) + + _request = build_export_configurations_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + export_id=export_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentExportConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, export_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Get the Continuous Export configuration for this export id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) + + _request = build_export_configurations_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + export_id=export_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentExportConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + export_id: str, + export_properties: _models.ApplicationInsightsComponentExportRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Update the Continuous Export configuration for this export id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :param export_properties: Properties that need to be specified to update the Continuous Export + configuration. Required. + :type export_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + export_id: str, + export_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Update the Continuous Export configuration for this export id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :param export_properties: Properties that need to be specified to update the Continuous Export + configuration. Required. + :type export_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + export_id: str, + export_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Update the Continuous Export configuration for this export id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :param export_properties: Properties that need to be specified to update the Continuous Export + configuration. Required. + :type export_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + export_id: str, + export_properties: Union[_models.ApplicationInsightsComponentExportRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentExportConfiguration: + """Update the Continuous Export configuration for this export id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param export_id: The Continuous Export configuration ID. This is unique within a Application + Insights component. Required. + :type export_id: str + :param export_properties: Properties that need to be specified to update the Continuous Export + configuration. Is one of the following types: ApplicationInsightsComponentExportRequest, JSON, + IO[bytes] Required. + :type export_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportRequest or JSON or + IO[bytes] + :return: ApplicationInsightsComponentExportConfiguration. The + ApplicationInsightsComponentExportConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentExportConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(export_properties, (IOBase, bytes)): + _content = export_properties + else: + _content = json.dumps(export_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_export_configurations_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + export_id=export_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentExportConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ComponentCurrentBillingFeaturesOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`component_current_billing_features` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentBillingFeatures: + """Returns current billing features for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponentBillingFeatures. The + ApplicationInsightsComponentBillingFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) + + _request = build_component_current_billing_features_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentBillingFeatures, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + billing_features_properties: _models.ApplicationInsightsComponentBillingFeatures, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentBillingFeatures: + """Update current billing features for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param billing_features_properties: The request body. Required. + :type billing_features_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentBillingFeatures. The + ApplicationInsightsComponentBillingFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + billing_features_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentBillingFeatures: + """Update current billing features for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param billing_features_properties: The request body. Required. + :type billing_features_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentBillingFeatures. The + ApplicationInsightsComponentBillingFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + billing_features_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentBillingFeatures: + """Update current billing features for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param billing_features_properties: The request body. Required. + :type billing_features_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentBillingFeatures. The + ApplicationInsightsComponentBillingFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + billing_features_properties: Union[_models.ApplicationInsightsComponentBillingFeatures, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentBillingFeatures: + """Update current billing features for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param billing_features_properties: The request body. Is one of the following types: + ApplicationInsightsComponentBillingFeatures, JSON, IO[bytes] Required. + :type billing_features_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures or JSON or + IO[bytes] + :return: ApplicationInsightsComponentBillingFeatures. The + ApplicationInsightsComponentBillingFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentBillingFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(billing_features_properties, (IOBase, bytes)): + _content = billing_features_properties + else: + _content = json.dumps(billing_features_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_component_current_billing_features_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentBillingFeatures, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ComponentQuotaStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`component_quota_status` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentQuotaStatus: + """Returns daily data volume cap (quota) status for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponentQuotaStatus. The ApplicationInsightsComponentQuotaStatus + is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentQuotaStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentQuotaStatus] = kwargs.pop("cls", None) + + _request = build_component_quota_status_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentQuotaStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ComponentFeatureCapabilitiesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`component_feature_capabilities` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentFeatureCapabilities: + """Returns feature capabilities of the application insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponentFeatureCapabilities. The + ApplicationInsightsComponentFeatureCapabilities is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFeatureCapabilities + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentFeatureCapabilities] = kwargs.pop("cls", None) + + _request = build_component_feature_capabilities_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentFeatureCapabilities, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ComponentAvailableFeaturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`component_available_features` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentAvailableFeatures: + """Returns all available features of the application insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponentAvailableFeatures. The + ApplicationInsightsComponentAvailableFeatures is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentAvailableFeatures + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentAvailableFeatures] = kwargs.pop("cls", None) + + _request = build_component_available_features_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentAvailableFeatures, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`proactive_detection_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]: + """Gets a list of ProactiveDetection configurations of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: list of ApplicationInsightsComponentProactiveDetectionConfiguration + :rtype: + list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( + "cls", None + ) + + _request = build_proactive_detection_configurations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize( + List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration], response.json() + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, configuration_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Get the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration. The + ApplicationInsightsComponentProactiveDetectionConfiguration is compatible with MutableMapping + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) + + _request = build_proactive_detection_configurations_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + configuration_id=configuration_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize( + _models.ApplicationInsightsComponentProactiveDetectionConfiguration, response.json() + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: _models.ApplicationInsightsComponentProactiveDetectionConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Required. + :type proactive_detection_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration. The + ApplicationInsightsComponentProactiveDetectionConfiguration is compatible with MutableMapping + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Required. + :type proactive_detection_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration. The + ApplicationInsightsComponentProactiveDetectionConfiguration is compatible with MutableMapping + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Required. + :type proactive_detection_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentProactiveDetectionConfiguration. The + ApplicationInsightsComponentProactiveDetectionConfiguration is compatible with MutableMapping + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + configuration_id: str, + proactive_detection_properties: Union[ + _models.ApplicationInsightsComponentProactiveDetectionConfiguration, JSON, IO[bytes] + ], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: + """Update the ProactiveDetection configuration for this configuration id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param configuration_id: The ProactiveDetection configuration ID. This is unique within a + Application Insights component. Required. + :type configuration_id: str + :param proactive_detection_properties: Properties that need to be specified to update the + ProactiveDetection configuration. Is one of the following types: + ApplicationInsightsComponentProactiveDetectionConfiguration, JSON, IO[bytes] Required. + :type proactive_detection_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + or JSON or IO[bytes] + :return: ApplicationInsightsComponentProactiveDetectionConfiguration. The + ApplicationInsightsComponentProactiveDetectionConfiguration is compatible with MutableMapping + :rtype: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentProactiveDetectionConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(proactive_detection_properties, (IOBase, bytes)): + _content = proactive_detection_properties + else: + _content = json.dumps(proactive_detection_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_proactive_detection_configurations_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + configuration_id=configuration_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize( + _models.ApplicationInsightsComponentProactiveDetectionConfiguration, response.json() + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class WorkItemConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`work_item_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> ItemPaged["_models.WorkItemConfiguration"]: + """Gets the list work item configurations that exist for the application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: An iterator like instance of WorkItemConfiguration + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.WorkItemConfiguration] + :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", "2015-05-01")) + cls: ClsType[List[_models.WorkItemConfiguration]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_work_item_configurations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.WorkItemConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.WorkItemConfigurationError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + work_item_configuration_properties: _models.WorkItemCreateConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Create a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_configuration_properties: Work item configuration creation payload. Required. + :type work_item_configuration_properties: + ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + work_item_configuration_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Create a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_configuration_properties: Work item configuration creation payload. Required. + :type work_item_configuration_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + resource_name: str, + work_item_configuration_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Create a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_configuration_properties: Work item configuration creation payload. Required. + :type work_item_configuration_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + resource_name: str, + work_item_configuration_properties: Union[_models.WorkItemCreateConfiguration, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Create a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_configuration_properties: Work item configuration creation payload. Is one of + the following types: WorkItemCreateConfiguration, JSON, IO[bytes] Required. + :type work_item_configuration_properties: + ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration or JSON or IO[bytes] + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(work_item_configuration_properties, (IOBase, bytes)): + _content = work_item_configuration_properties + else: + _content = json.dumps(work_item_configuration_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_work_item_configurations_create_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkItemConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_default(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.WorkItemConfiguration: + """Gets default work item configurations that exist for the application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) + + _request = build_work_item_configurations_get_default_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkItemConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, work_item_config_id: str, **kwargs: Any + ) -> None: + """Delete a work item configuration of an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_work_item_configurations_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + work_item_config_id=work_item_config_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get_item( + self, resource_group_name: str, resource_name: str, work_item_config_id: str, **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Gets specified work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) + + _request = build_work_item_configurations_get_item_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + work_item_config_id=work_item_config_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkItemConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_item( + self, + resource_group_name: str, + resource_name: str, + work_item_config_id: str, + work_item_configuration_properties: _models.WorkItemCreateConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Update a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :param work_item_configuration_properties: Properties that need to be specified to update a + work item configuration for this Application Insights component. Required. + :type work_item_configuration_properties: + ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_item( + self, + resource_group_name: str, + resource_name: str, + work_item_config_id: str, + work_item_configuration_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Update a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :param work_item_configuration_properties: Properties that need to be specified to update a + work item configuration for this Application Insights component. Required. + :type work_item_configuration_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_item( + self, + resource_group_name: str, + resource_name: str, + work_item_config_id: str, + work_item_configuration_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Update a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :param work_item_configuration_properties: Properties that need to be specified to update a + work item configuration for this Application Insights component. Required. + :type work_item_configuration_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_item( + self, + resource_group_name: str, + resource_name: str, + work_item_config_id: str, + work_item_configuration_properties: Union[_models.WorkItemCreateConfiguration, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.WorkItemConfiguration: + """Update a work item configuration for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param work_item_config_id: The unique work item configuration Id. This can be either friendly + name of connector as defined in connector configuration. Required. + :type work_item_config_id: str + :param work_item_configuration_properties: Properties that need to be specified to update a + work item configuration for this Application Insights component. Is one of the following types: + WorkItemCreateConfiguration, JSON, IO[bytes] Required. + :type work_item_configuration_properties: + ~azure.mgmt.applicationinsights.models.WorkItemCreateConfiguration or JSON or IO[bytes] + :return: WorkItemConfiguration. The WorkItemConfiguration is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.WorkItemConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(work_item_configuration_properties, (IOBase, bytes)): + _content = work_item_configuration_properties + else: + _content = json.dumps(work_item_configuration_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_work_item_configurations_update_item_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + work_item_config_id=work_item_config_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.WorkItemConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ComponentLinkedStorageAccountsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`component_linked_storage_accounts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, storage_type: Union[str, _models.StorageType], **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Returns the current linked storage settings for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) + + _request = build_component_linked_storage_accounts_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + storage_type=storage_type, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComponentLinkedStorageAccounts, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_and_update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: _models.ComponentLinkedStorageAccounts, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Replace current linked storage account for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: + ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_and_update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Replace current linked storage account for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_and_update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Replace current linked storage account for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_and_update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: Union[_models.ComponentLinkedStorageAccounts, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Replace current linked storage account for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update + linked storage accounts for an Application Insights component. Is one of the following types: + ComponentLinkedStorageAccounts, JSON, IO[bytes] Required. + :type linked_storage_accounts_properties: + ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts or JSON or IO[bytes] + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): + _content = linked_storage_accounts_properties + else: + _content = json.dumps(linked_storage_accounts_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_component_linked_storage_accounts_create_and_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + storage_type=storage_type, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComponentLinkedStorageAccounts, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: _models.ComponentLinkedStorageAccountsPatch, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Update linked storage accounts for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update a + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: + ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccountsPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Update linked storage accounts for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update a + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Update linked storage accounts for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update a + linked storage accounts for an Application Insights component. Required. + :type linked_storage_accounts_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + storage_type: Union[str, _models.StorageType], + linked_storage_accounts_properties: Union[_models.ComponentLinkedStorageAccountsPatch, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentLinkedStorageAccounts: + """Update linked storage accounts for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :param linked_storage_accounts_properties: Properties that need to be specified to update a + linked storage accounts for an Application Insights component. Is one of the following types: + ComponentLinkedStorageAccountsPatch, JSON, IO[bytes] Required. + :type linked_storage_accounts_properties: + ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccountsPatch or JSON or IO[bytes] + :return: ComponentLinkedStorageAccounts. The ComponentLinkedStorageAccounts is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentLinkedStorageAccounts + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): + _content = linked_storage_accounts_properties + else: + _content = json.dumps(linked_storage_accounts_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_component_linked_storage_accounts_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + storage_type=storage_type, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComponentLinkedStorageAccounts, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, storage_type: Union[str, _models.StorageType], **kwargs: Any + ) -> None: + """Delete linked storage accounts for an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param storage_type: The type of the Application Insights component data source for the linked + storage account. "ServiceProfiler" Required. + :type storage_type: str or ~azure.mgmt.applicationinsights.models.StorageType + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-03-01-preview")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_component_linked_storage_accounts_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + storage_type=storage_type, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseLinkedStorage, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class ComponentsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`components` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ApplicationInsightsComponent: + """Returns an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + _request = build_components_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: _models.ApplicationInsightsComponent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Required. + :type insight_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + resource_name: str, + insight_properties: Union[_models.ApplicationInsightsComponent, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Creates (or updates) an Application Insights component. Note: You cannot specify a different + value for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param insight_properties: Properties that need to be specified to create an Application + Insights component. Is one of the following types: ApplicationInsightsComponent, JSON, + IO[bytes] Required. + :type insight_properties: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + or JSON or IO[bytes] + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(insight_properties, (IOBase, bytes)): + _content = insight_properties + else: + _content = json.dumps(insight_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_components_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: ~azure.mgmt.applicationinsights.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Required. + :type component_tags: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + resource_name: str, + component_tags: Union[_models.TagsResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponent: + """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param component_tags: Updated tag information to set into the component instance. Is one of + the following types: TagsResource, JSON, IO[bytes] Required. + :type component_tags: ~azure.mgmt.applicationinsights.models.TagsResource or JSON or IO[bytes] + :return: ApplicationInsightsComponent. The ApplicationInsightsComponent is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(component_tags, (IOBase, bytes)): + _content = component_tags + else: + _content = json.dumps(component_tags, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_components_update_tags_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponent, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> None: + """Deletes an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_components_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> ItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of Application Insights components within a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of ApplicationInsightsComponent + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent] + :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", "2020-02-02")) + cls: ClsType[List[_models.ApplicationInsightsComponent]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_components_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ApplicationInsightsComponent], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.ApplicationInsightsComponent"]: + """Gets a list of all Application Insights components within a subscription. + + :return: An iterator like instance of ApplicationInsightsComponent + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponent] + :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", "2020-02-02")) + cls: ClsType[List[_models.ApplicationInsightsComponent]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_components_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ApplicationInsightsComponent], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def purge( + self, + resource_group_name: str, + resource_name: str, + body: _models.ComponentPurgeBody, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(`https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge + `_) , scoped to + specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: ~azure.mgmt.applicationinsights.models.ComponentPurgeBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse. The ComponentPurgeResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def purge( + self, + resource_group_name: str, + resource_name: str, + body: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(`https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge + `_) , scoped to + specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse. The ComponentPurgeResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def purge( + self, + resource_group_name: str, + resource_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(`https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge + `_) , scoped to + specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ComponentPurgeResponse. The ComponentPurgeResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def purge( + self, + resource_group_name: str, + resource_name: str, + body: Union[_models.ComponentPurgeBody, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ComponentPurgeResponse: + """Purges data in an Application Insights component by a set of user-defined filters. + + In order to manage system resources, purge requests are throttled at 50 requests per hour. You + should batch the execution of purge requests by sending a single command whose predicate + includes all user identities that require purging. Use the in operator to specify multiple + identities. You should run the query prior to using for a purge request to verify that the + results are expected. + Note: this operation is intended for Classic resources, for workspace-based Application + Insights resource please run purge operation (directly on the + workspace)(`https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge + `_) , scoped to + specific resource id. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param body: Describes the body of a request to purge data in a single table of an Application + Insights component. Is one of the following types: ComponentPurgeBody, JSON, IO[bytes] + Required. + :type body: ~azure.mgmt.applicationinsights.models.ComponentPurgeBody or JSON or IO[bytes] + :return: ComponentPurgeResponse. The ComponentPurgeResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_components_purge_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComponentPurgeResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_purge_status( + self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any + ) -> _models.ComponentPurgeStatusResponse: + """Get status for an ongoing purge operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param purge_id: In a purge status request, this is the Id of the operation the status of which + is returned. Required. + :type purge_id: str + :return: ComponentPurgeStatusResponse. The ComponentPurgeStatusResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ComponentPurgeStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) + cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) + + _request = build_components_get_purge_status_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + purge_id=purge_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponseComponents, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ComponentPurgeStatusResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class DeletedWorkbooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`deleted_workbooks` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_subscription( + self, + *, + category: Optional[Union[str, _models.DeletedWorkbookCategoryType]] = None, + tags: Optional[List[str]] = None, + **kwargs: Any + ) -> ItemPaged["_models.DeletedWorkbook"]: + """Get all recently deleted Workbooks in a specified subscription. + + :keyword category: Category of workbook to return. Known values are: "workbook", "TSG", + "performance", and "retention". Default value is None. + :paramtype category: str or ~azure.mgmt.applicationinsights.models.DeletedWorkbookCategoryType + :keyword tags: Tags presents on each workbook returned. Default value is None. + :paramtype tags: list[str] + :return: An iterator like instance of DeletedWorkbook + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.DeletedWorkbook] + :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", "2024-02-01-preview")) + cls: ClsType[List[_models.DeletedWorkbook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deleted_workbooks_list_by_subscription_request( + subscription_id=self._config.subscription_id, + category=category, + tags=tags, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.DeletedWorkbook], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.DeletedWorkbookError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class FavoritesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`favorites` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, + resource_group_name: str, + resource_name: str, + *, + favorite_type: Optional[Union[str, _models.FavoriteType]] = None, + source_type: Optional[Union[str, _models.FavoriteSourceType]] = None, + can_fetch_content: Optional[bool] = None, + tags: Optional[List[str]] = None, + **kwargs: Any + ) -> List[_models.ApplicationInsightsComponentFavorite]: + """Gets a list of favorites defined within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :keyword favorite_type: The type of favorite. Value can be either shared or user. Known values + are: "shared" and "user". Default value is None. + :paramtype favorite_type: str or ~azure.mgmt.applicationinsights.models.FavoriteType + :keyword source_type: Source type of favorite to return. When left out, the source type + defaults to 'other' (not present in this enum). Known values are: "retention", "notebook", + "sessions", "events", "userflows", "funnel", "impact", and "segmentation". Default value is + None. + :paramtype source_type: str or ~azure.mgmt.applicationinsights.models.FavoriteSourceType + :keyword can_fetch_content: Flag indicating whether or not to return the full content for each + applicable favorite. If false, only return summary content for favorites. Default value is + None. + :paramtype can_fetch_content: bool + :keyword tags: Tags that must be present on each favorite returned. Default value is None. + :paramtype tags: list[str] + :return: list of ApplicationInsightsComponentFavorite + :rtype: list[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite] + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentFavorite]] = kwargs.pop("cls", None) + + _request = build_favorites_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + favorite_type=favorite_type, + source_type=source_type, + can_fetch_content=can_fetch_content, + tags=tags, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(List[_models.ApplicationInsightsComponentFavorite], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, resource_name: str, favorite_id: str, **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Get a single favorite by its FavoriteId, defined within an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) + + _request = build_favorites_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + favorite_id=favorite_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentFavorite, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def add( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: _models.ApplicationInsightsComponentFavorite, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Adds a new favorites to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to create a new favorite and + add it to an Application Insights component. Required. + :type favorite_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Adds a new favorites to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to create a new favorite and + add it to an Application Insights component. Required. + :type favorite_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def add( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Adds a new favorites to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to create a new favorite and + add it to an Application Insights component. Required. + :type favorite_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def add( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: Union[_models.ApplicationInsightsComponentFavorite, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Adds a new favorites to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to create a new favorite and + add it to an Application Insights component. Is one of the following types: + ApplicationInsightsComponentFavorite, JSON, IO[bytes] Required. + :type favorite_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite or JSON or + IO[bytes] + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(favorite_properties, (IOBase, bytes)): + _content = favorite_properties + else: + _content = json.dumps(favorite_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_favorites_add_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + favorite_id=favorite_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentFavorite, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: _models.ApplicationInsightsComponentFavorite, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Updates a favorite that has already been added to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to update the existing + favorite. Required. + :type favorite_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Updates a favorite that has already been added to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to update the existing + favorite. Required. + :type favorite_properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Updates a favorite that has already been added to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to update the existing + favorite. Required. + :type favorite_properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + resource_name: str, + favorite_id: str, + favorite_properties: Union[_models.ApplicationInsightsComponentFavorite, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationInsightsComponentFavorite: + """Updates a favorite that has already been added to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :param favorite_properties: Properties that need to be specified to update the existing + favorite. Is one of the following types: ApplicationInsightsComponentFavorite, JSON, IO[bytes] + Required. + :type favorite_properties: + ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite or JSON or + IO[bytes] + :return: ApplicationInsightsComponentFavorite. The ApplicationInsightsComponentFavorite is + compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentFavorite + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(favorite_properties, (IOBase, bytes)): + _content = favorite_properties + else: + _content = json.dumps(favorite_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_favorites_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + favorite_id=favorite_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ApplicationInsightsComponentFavorite, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, favorite_id: str, **kwargs: Any + ) -> None: + """Remove a favorite that is associated to an Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :param favorite_id: The Id of a specific favorite defined in the Application Insights + component. Required. + :type favorite_id: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_favorites_delete_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + favorite_id=favorite_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class LiveTokenOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`live_token` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: + """**Gets an access token for live metrics stream data.**. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. + Required. + :type resource_uri: str + :return: LiveTokenResponse. The LiveTokenResponse is compatible with MutableMapping + :rtype: ~azure.mgmt.applicationinsights.models.LiveTokenResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-10-14")) + cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) + + _request = build_live_token_get_request( + resource_uri=resource_uri, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.LiveTokenErrorResponseLinkedStorage, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LiveTokenResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class webTestLocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.applicationinsights.ApplicationInsightsManagementClient`'s + :attr:`web_test_locations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationInsightsManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, resource_name: str, **kwargs: Any + ) -> ItemPaged["_models.ApplicationInsightsComponentWebTestLocation"]: + """Gets a list of web test locations available to this Application Insights component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the Application Insights component resource. Required. + :type resource_name: str + :return: An iterator like instance of ApplicationInsightsComponentWebTestLocation + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.models.ApplicationInsightsComponentWebTestLocation] + :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", "2015-05-01")) + cls: ClsType[List[_models.ApplicationInsightsComponentWebTestLocation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_web_test_locations_list_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + _request = HttpRequest("GET", next_link) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ApplicationInsightsComponentWebTestLocation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_patch.py similarity index 100% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_patch.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/operations/_patch.py diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/py.typed similarity index 100% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/py.typed rename to sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/py.typed diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_configuration.py deleted file mode 100644 index 320522510ff1..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2015-05-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2015-05-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/__init__.py deleted file mode 100644 index a6e31fd3e1fd..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/__init__.py +++ /dev/null @@ -1,57 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import Operations # type: ignore -from ._annotations_operations import AnnotationsOperations # type: ignore -from ._api_keys_operations import APIKeysOperations # type: ignore -from ._export_configurations_operations import ExportConfigurationsOperations # type: ignore -from ._component_current_billing_features_operations import ComponentCurrentBillingFeaturesOperations # type: ignore -from ._component_quota_status_operations import ComponentQuotaStatusOperations # type: ignore -from ._component_feature_capabilities_operations import ComponentFeatureCapabilitiesOperations # type: ignore -from ._component_available_features_operations import ComponentAvailableFeaturesOperations # type: ignore -from ._proactive_detection_configurations_operations import ProactiveDetectionConfigurationsOperations # type: ignore -from ._components_operations import ComponentsOperations # type: ignore -from ._work_item_configurations_operations import WorkItemConfigurationsOperations # type: ignore -from ._favorites_operations import FavoritesOperations # type: ignore -from ._web_test_locations_operations import WebTestLocationsOperations # type: ignore -from ._web_tests_operations import WebTestsOperations # type: ignore -from ._analytics_items_operations import AnalyticsItemsOperations # type: ignore -from ._workbooks_operations import WorkbooksOperations # type: ignore -from ._my_workbooks_operations import MyWorkbooksOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "AnnotationsOperations", - "APIKeysOperations", - "ExportConfigurationsOperations", - "ComponentCurrentBillingFeaturesOperations", - "ComponentQuotaStatusOperations", - "ComponentFeatureCapabilitiesOperations", - "ComponentAvailableFeaturesOperations", - "ProactiveDetectionConfigurationsOperations", - "ComponentsOperations", - "WorkItemConfigurationsOperations", - "FavoritesOperations", - "WebTestLocationsOperations", - "WebTestsOperations", - "AnalyticsItemsOperations", - "WorkbooksOperations", - "MyWorkbooksOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_analytics_items_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_analytics_items_operations.py deleted file mode 100644 index fc97a948c436..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_analytics_items_operations.py +++ /dev/null @@ -1,461 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._analytics_items_operations import ( - build_delete_request, - build_get_request, - build_list_request, - build_put_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class AnalyticsItemsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`analytics_items` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - scope: Optional[Union[str, _models.ItemScope]] = None, - type: Union[str, _models.ItemTypeParameter] = "none", - include_content: Optional[bool] = None, - **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentAnalyticsItem]: - """Gets a list of Analytics Items defined within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param scope: Enum indicating if this item definition is owned by a specific user or is shared - between all users with access to the Application Insights component. Known values are: "shared" - and "user". Default value is None. - :type scope: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScope - :param type: Enum indicating the type of the Analytics item. Known values are: "none", "query", - "function", "folder", and "recent". Default value is "none". - :type type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemTypeParameter - :param include_content: Flag indicating whether or not to return the content of each applicable - item. If false, only return the item information. Default value is None. - :type include_content: bool - :return: list of ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.ApplicationInsightsComponentAnalyticsItem]] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - scope_path=scope_path, - subscription_id=self._config.subscription_id, - scope=scope, - type=type, - include_content=include_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[ApplicationInsightsComponentAnalyticsItem]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - id: Optional[str] = None, - name: Optional[str] = None, - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAnalyticsItem: - """Gets a specific Analytics Items defined within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param id: The Id of a specific item defined in the Application Insights component. Default - value is None. - :type id: str - :param name: The name of a specific item defined in the Application Insights component. Default - value is None. - :type name: str - :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - scope_path=scope_path, - subscription_id=self._config.subscription_id, - id=id, - name=name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentAnalyticsItem", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def put( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - item_properties: _models.ApplicationInsightsComponentAnalyticsItem, - override_item: Optional[bool] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAnalyticsItem: - """Adds or Updates a specific Analytics Item within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param item_properties: Properties that need to be specified to create a new item and add it to - an Application Insights component. Required. - :type item_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem - :param override_item: Flag indicating whether or not to force save an item. This allows - overriding an item if it already exists. Default value is None. - :type override_item: bool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - item_properties: IO[bytes], - override_item: Optional[bool] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAnalyticsItem: - """Adds or Updates a specific Analytics Item within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param item_properties: Properties that need to be specified to create a new item and add it to - an Application Insights component. Required. - :type item_properties: IO[bytes] - :param override_item: Flag indicating whether or not to force save an item. This allows - overriding an item if it already exists. Default value is None. - :type override_item: bool - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - item_properties: Union[_models.ApplicationInsightsComponentAnalyticsItem, IO[bytes]], - override_item: Optional[bool] = None, - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAnalyticsItem: - """Adds or Updates a specific Analytics Item within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param item_properties: Properties that need to be specified to create a new item and add it to - an Application Insights component. Is either a ApplicationInsightsComponentAnalyticsItem type - or a IO[bytes] type. Required. - :type item_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem or - IO[bytes] - :param override_item: Flag indicating whether or not to force save an item. This allows - overriding an item if it already exists. Default value is None. - :type override_item: bool - :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(item_properties, (IOBase, bytes)): - _content = item_properties - else: - _json = self._serialize.body(item_properties, "ApplicationInsightsComponentAnalyticsItem") - - _request = build_put_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - scope_path=scope_path, - subscription_id=self._config.subscription_id, - override_item=override_item, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentAnalyticsItem", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - id: Optional[str] = None, - name: Optional[str] = None, - **kwargs: Any - ) -> None: - """Deletes a specific Analytics Items defined within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param id: The Id of a specific item defined in the Application Insights component. Default - value is None. - :type id: str - :param name: The name of a specific item defined in the Application Insights component. Default - value is None. - :type name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - scope_path=scope_path, - subscription_id=self._config.subscription_id, - id=id, - name=name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_annotations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_annotations_operations.py deleted file mode 100644 index 38f89b3fc862..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_annotations_operations.py +++ /dev/null @@ -1,416 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._annotations_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class AnnotationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`annotations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, start: str, end: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Annotation"]: - """Gets the list of annotations for a component for given time range. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param start: The start time to query from for annotations, cannot be older than 90 days from - current date. Required. - :type start: str - :param end: The end time to query for annotations. Required. - :type end: str - :return: An iterator like instance of either Annotation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AnnotationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - start=start, - end=end, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AnnotationsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.AnnotationError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - annotation_properties: _models.Annotation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> List[_models.Annotation]: - """Create an Annotation of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param annotation_properties: Properties that need to be specified to create an annotation of a - Application Insights component. Required. - :type annotation_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - annotation_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> List[_models.Annotation]: - """Create an Annotation of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param annotation_properties: Properties that need to be specified to create an annotation of a - Application Insights component. Required. - :type annotation_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - resource_name: str, - annotation_properties: Union[_models.Annotation, IO[bytes]], - **kwargs: Any - ) -> List[_models.Annotation]: - """Create an Annotation of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param annotation_properties: Properties that need to be specified to create an annotation of a - Application Insights component. Is either a Annotation type or a IO[bytes] type. Required. - :type annotation_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation or - IO[bytes] - :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(annotation_properties, (IOBase, bytes)): - _content = annotation_properties - else: - _json = self._serialize.body(annotation_properties, "Annotation") - - _request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.AnnotationError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[Annotation]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, annotation_id: str, **kwargs: Any) -> None: - """Delete an Annotation of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param annotation_id: The unique annotation ID. This is unique within a Application Insights - component. Required. - :type annotation_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - annotation_id=annotation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, annotation_id: str, **kwargs: Any - ) -> List[_models.Annotation]: - """Get the annotation for given id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param annotation_id: The unique annotation ID. This is unique within a Application Insights - component. Required. - :type annotation_id: str - :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - annotation_id=annotation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.AnnotationError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[Annotation]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_api_keys_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_api_keys_operations.py deleted file mode 100644 index 60c32309b6f1..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_api_keys_operations.py +++ /dev/null @@ -1,405 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._api_keys_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class APIKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`api_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ApplicationInsightsComponentAPIKey"]: - """Gets a list of API keys of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: An iterator like instance of either ApplicationInsightsComponentAPIKey or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentAPIKeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentAPIKeyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - api_key_properties: _models.APIKeyRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAPIKey: - """Create an API Key of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param api_key_properties: Properties that need to be specified to create an API key of a - Application Insights component. Required. - :type api_key_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.APIKeyRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - api_key_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAPIKey: - """Create an API Key of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param api_key_properties: Properties that need to be specified to create an API key of a - Application Insights component. Required. - :type api_key_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - resource_name: str, - api_key_properties: Union[_models.APIKeyRequest, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAPIKey: - """Create an API Key of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param api_key_properties: Properties that need to be specified to create an API key of a - Application Insights component. Is either a APIKeyRequest type or a IO[bytes] type. Required. - :type api_key_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.APIKeyRequest or - IO[bytes] - :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_key_properties, (IOBase, bytes)): - _content = api_key_properties - else: - _json = self._serialize.body(api_key_properties, "APIKeyRequest") - - _request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentAPIKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, resource_group_name: str, resource_name: str, key_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentAPIKey: - """Delete an API Key of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param key_id: The API Key ID. This is unique within a Application Insights component. - Required. - :type key_id: str - :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - key_id=key_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentAPIKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, key_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentAPIKey: - """Get the API Key for this key id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param key_id: The API Key ID. This is unique within a Application Insights component. - Required. - :type key_id: str - :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - key_id=key_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentAPIKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_available_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_available_features_operations.py deleted file mode 100644 index 4d7011391cab..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_available_features_operations.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._component_available_features_operations import build_get_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ComponentAvailableFeaturesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`component_available_features` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentAvailableFeatures: - """Returns all available features of the application insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponentAvailableFeatures or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAvailableFeatures - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentAvailableFeatures] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentAvailableFeatures", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_current_billing_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_current_billing_features_operations.py deleted file mode 100644 index a54b4e28912e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_current_billing_features_operations.py +++ /dev/null @@ -1,253 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._component_current_billing_features_operations import build_get_request, build_update_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ComponentCurrentBillingFeaturesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`component_current_billing_features` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentBillingFeatures: - """Returns current billing features for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentBillingFeatures", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - billing_features_properties: _models.ApplicationInsightsComponentBillingFeatures, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentBillingFeatures: - """Update current billing features for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param billing_features_properties: Properties that need to be specified to update billing - features for an Application Insights component. Required. - :type billing_features_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - billing_features_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentBillingFeatures: - """Update current billing features for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param billing_features_properties: Properties that need to be specified to update billing - features for an Application Insights component. Required. - :type billing_features_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - billing_features_properties: Union[_models.ApplicationInsightsComponentBillingFeatures, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentBillingFeatures: - """Update current billing features for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param billing_features_properties: Properties that need to be specified to update billing - features for an Application Insights component. Is either a - ApplicationInsightsComponentBillingFeatures type or a IO[bytes] type. Required. - :type billing_features_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - or IO[bytes] - :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(billing_features_properties, (IOBase, bytes)): - _content = billing_features_properties - else: - _json = self._serialize.body(billing_features_properties, "ApplicationInsightsComponentBillingFeatures") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentBillingFeatures", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_feature_capabilities_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_feature_capabilities_operations.py deleted file mode 100644 index 5ff34841b547..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_feature_capabilities_operations.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._component_feature_capabilities_operations import build_get_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ComponentFeatureCapabilitiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`component_feature_capabilities` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentFeatureCapabilities: - """Returns feature capabilities of the application insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponentFeatureCapabilities or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFeatureCapabilities - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentFeatureCapabilities] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentFeatureCapabilities", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_quota_status_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_quota_status_operations.py deleted file mode 100644 index 73ad86ae04b1..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_component_quota_status_operations.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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._component_quota_status_operations import build_get_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ComponentQuotaStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`component_quota_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentQuotaStatus: - """Returns daily data volume cap (quota) status for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponentQuotaStatus or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentQuotaStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentQuotaStatus] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentQuotaStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_components_operations.py deleted file mode 100644 index aba304c5ca97..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_components_operations.py +++ /dev/null @@ -1,815 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._components_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_purge_status_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_purge_request, - build_update_tags_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of all Application Insights components within a subscription. - - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of Application Insights components within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Deletes an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Returns an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: _models.ApplicationInsightsComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. - Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent or IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(insight_properties, (IOBase, bytes)): - _content = insight_properties - else: - _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource or - IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(component_tags, (IOBase, bytes)): - _content = component_tags - else: - _json = self._serialize.body(component_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: _models.ComponentPurgeBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: Union[_models.ComponentPurgeBody, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBody or IO[bytes] - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "ComponentPurgeBody") - - _request = build_purge_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_purge_status( - self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any - ) -> _models.ComponentPurgeStatusResponse: - """Get status for an ongoing purge operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param purge_id: In a purge status request, this is the Id of the operation the status of which - is returned. Required. - :type purge_id: str - :return: ComponentPurgeStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeStatusResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) - - _request = build_get_purge_status_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - purge_id=purge_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_export_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_export_configurations_operations.py deleted file mode 100644 index 63a166bec93f..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_export_configurations_operations.py +++ /dev/null @@ -1,545 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._export_configurations_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ExportConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`export_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: - """Gets a list of Continuous Export configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "[ApplicationInsightsComponentExportConfiguration]", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - export_properties: _models.ApplicationInsightsComponentExportRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: - """Create a Continuous Export configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_properties: Properties that need to be specified to create a Continuous Export - configuration of a Application Insights component. Required. - :type export_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - export_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: - """Create a Continuous Export configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_properties: Properties that need to be specified to create a Continuous Export - configuration of a Application Insights component. Required. - :type export_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - resource_name: str, - export_properties: Union[_models.ApplicationInsightsComponentExportRequest, IO[bytes]], - **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: - """Create a Continuous Export configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_properties: Properties that need to be specified to create a Continuous Export - configuration of a Application Insights component. Is either a - ApplicationInsightsComponentExportRequest type or a IO[bytes] type. Required. - :type export_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest or - IO[bytes] - :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(export_properties, (IOBase, bytes)): - _content = export_properties - else: - _json = self._serialize.body(export_properties, "ApplicationInsightsComponentExportRequest") - - _request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "[ApplicationInsightsComponentExportConfiguration]", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, resource_group_name: str, resource_name: str, export_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentExportConfiguration: - """Delete a Continuous Export configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_id: The Continuous Export configuration ID. This is unique within a Application - Insights component. Required. - :type export_id: str - :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - export_id=export_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentExportConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, export_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentExportConfiguration: - """Get the Continuous Export configuration for this export id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_id: The Continuous Export configuration ID. This is unique within a Application - Insights component. Required. - :type export_id: str - :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - export_id=export_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentExportConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - export_id: str, - export_properties: _models.ApplicationInsightsComponentExportRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentExportConfiguration: - """Update the Continuous Export configuration for this export id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_id: The Continuous Export configuration ID. This is unique within a Application - Insights component. Required. - :type export_id: str - :param export_properties: Properties that need to be specified to update the Continuous Export - configuration. Required. - :type export_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - export_id: str, - export_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentExportConfiguration: - """Update the Continuous Export configuration for this export id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_id: The Continuous Export configuration ID. This is unique within a Application - Insights component. Required. - :type export_id: str - :param export_properties: Properties that need to be specified to update the Continuous Export - configuration. Required. - :type export_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - export_id: str, - export_properties: Union[_models.ApplicationInsightsComponentExportRequest, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentExportConfiguration: - """Update the Continuous Export configuration for this export id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_id: The Continuous Export configuration ID. This is unique within a Application - Insights component. Required. - :type export_id: str - :param export_properties: Properties that need to be specified to update the Continuous Export - configuration. Is either a ApplicationInsightsComponentExportRequest type or a IO[bytes] type. - Required. - :type export_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest or - IO[bytes] - :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(export_properties, (IOBase, bytes)): - _content = export_properties - else: - _json = self._serialize.body(export_properties, "ApplicationInsightsComponentExportRequest") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - export_id=export_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentExportConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_favorites_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_favorites_operations.py deleted file mode 100644 index fbca9cd3357e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_favorites_operations.py +++ /dev/null @@ -1,557 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._favorites_operations import ( - build_add_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class FavoritesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`favorites` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list( - self, - resource_group_name: str, - resource_name: str, - favorite_type: Optional[Union[str, _models.FavoriteType]] = None, - source_type: Optional[Union[str, _models.FavoriteSourceType]] = None, - can_fetch_content: Optional[bool] = None, - tags: Optional[List[str]] = None, - **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentFavorite]: - """Gets a list of favorites defined within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_type: The type of favorite. Value can be either shared or user. Known values - are: "shared" and "user". Default value is None. - :type favorite_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteType - :param source_type: Source type of favorite to return. When left out, the source type defaults - to 'other' (not present in this enum). Known values are: "retention", "notebook", "sessions", - "events", "userflows", "funnel", "impact", and "segmentation". Default value is None. - :type source_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteSourceType - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable favorite. If false, only return summary content for favorites. Default value is - None. - :type can_fetch_content: bool - :param tags: Tags that must be present on each favorite returned. Default value is None. - :type tags: list[str] - :return: list of ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.ApplicationInsightsComponentFavorite]] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - favorite_type=favorite_type, - source_type=source_type, - can_fetch_content=can_fetch_content, - tags=tags, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[ApplicationInsightsComponentFavorite]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, favorite_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Get a single favorite by its FavoriteId, defined within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - favorite_id=favorite_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentFavorite", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def add( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: _models.ApplicationInsightsComponentFavorite, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Adds a new favorites to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to create a new favorite and - add it to an Application Insights component. Required. - :type favorite_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def add( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Adds a new favorites to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to create a new favorite and - add it to an Application Insights component. Required. - :type favorite_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def add( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: Union[_models.ApplicationInsightsComponentFavorite, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Adds a new favorites to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to create a new favorite and - add it to an Application Insights component. Is either a ApplicationInsightsComponentFavorite - type or a IO[bytes] type. Required. - :type favorite_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite or - IO[bytes] - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(favorite_properties, (IOBase, bytes)): - _content = favorite_properties - else: - _json = self._serialize.body(favorite_properties, "ApplicationInsightsComponentFavorite") - - _request = build_add_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - favorite_id=favorite_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentFavorite", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: _models.ApplicationInsightsComponentFavorite, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Updates a favorite that has already been added to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to update the existing - favorite. Required. - :type favorite_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Updates a favorite that has already been added to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to update the existing - favorite. Required. - :type favorite_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: Union[_models.ApplicationInsightsComponentFavorite, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Updates a favorite that has already been added to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to update the existing - favorite. Is either a ApplicationInsightsComponentFavorite type or a IO[bytes] type. Required. - :type favorite_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite or - IO[bytes] - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(favorite_properties, (IOBase, bytes)): - _content = favorite_properties - else: - _json = self._serialize.body(favorite_properties, "ApplicationInsightsComponentFavorite") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - favorite_id=favorite_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentFavorite", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, favorite_id: str, **kwargs: Any) -> None: - """Remove a favorite that is associated to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - favorite_id=favorite_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_my_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_my_workbooks_operations.py deleted file mode 100644 index f19c5b68ab18..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_my_workbooks_operations.py +++ /dev/null @@ -1,653 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._my_workbooks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class MyWorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`my_workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.MyWorkbook"]: - """Get all private workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either MyWorkbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MyWorkbooksListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription( - self, - category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.MyWorkbook"]: - """Get all private workbooks defined within a specified subscription and category. - - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either MyWorkbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MyWorkbooksListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.MyWorkbook: - """Get a single private workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Delete a private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.MyWorkbook, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.MyWorkbook, IO[bytes]], - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook or - IO[bytes] - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "MyWorkbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.MyWorkbook, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.MyWorkbook, IO[bytes]], - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook or - IO[bytes] - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "MyWorkbook") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_operations.py deleted file mode 100644 index 36c4f85b1c79..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: - """Lists all of the available insights REST API operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_proactive_detection_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_proactive_detection_configurations_operations.py deleted file mode 100644 index 94adfd07704e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_proactive_detection_configurations_operations.py +++ /dev/null @@ -1,350 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._proactive_detection_configurations_operations import ( - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`proactive_detection_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]: - """Gets a list of ProactiveDetection configurations of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: list of ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( - "cls", None - ) - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "[ApplicationInsightsComponentProactiveDetectionConfiguration]", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, configuration_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Get the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - configuration_id=configuration_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: _models.ApplicationInsightsComponentProactiveDetectionConfiguration, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Required. - :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Required. - :type proactive_detection_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: Union[ - _models.ApplicationInsightsComponentProactiveDetectionConfiguration, IO[bytes] - ], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Is either a - ApplicationInsightsComponentProactiveDetectionConfiguration type or a IO[bytes] type. Required. - :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - or IO[bytes] - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(proactive_detection_properties, (IOBase, bytes)): - _content = proactive_detection_properties - else: - _json = self._serialize.body( - proactive_detection_properties, "ApplicationInsightsComponentProactiveDetectionConfiguration" - ) - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - configuration_id=configuration_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_test_locations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_test_locations_operations.py deleted file mode 100644 index 964e82d4a1b3..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_test_locations_operations.py +++ /dev/null @@ -1,143 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._web_test_locations_operations import build_list_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WebTestLocationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`web_test_locations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ApplicationInsightsComponentWebTestLocation"]: - """Gets a list of web test locations available to this Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: An iterator like instance of either ApplicationInsightsComponentWebTestLocation or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentWebTestLocation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsWebTestLocationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsWebTestLocationsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_tests_operations.py deleted file mode 100644 index 3173e0322573..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_web_tests_operations.py +++ /dev/null @@ -1,676 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._web_tests_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_component_request, - build_list_by_resource_group_request, - build_list_request, - build_update_tags_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WebTestsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`web_tests` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined within a specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: - """Get a specific Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: _models.WebTest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: Union[_models.WebTest, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. - Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest or - IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_definition, (IOBase, bytes)): - _content = web_test_definition - else: - _json = self._serialize.body(web_test_definition, "WebTest") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Required. - :type web_test_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource or - IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_tags, (IOBase, bytes)): - _content = web_test_tags - else: - _json = self._serialize.body(web_test_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> None: - """Deletes an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: - """Get all Application Insights web test alerts definitions within a subscription. - - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_component( - self, component_name: str, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined for the specified component. - - :param component_name: The name of the Application Insights component resource. Required. - :type component_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_component_request( - component_name=component_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_work_item_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_work_item_configurations_operations.py deleted file mode 100644 index 4e922245cd4d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_work_item_configurations_operations.py +++ /dev/null @@ -1,614 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._work_item_configurations_operations import ( - build_create_request, - build_delete_request, - build_get_default_request, - build_get_item_request, - build_list_request, - build_update_item_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WorkItemConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`work_item_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.WorkItemConfiguration"]: - """Gets the list work item configurations that exist for the application. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: An iterator like instance of either WorkItemConfiguration or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkItemConfigurationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkItemConfigurationsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.WorkItemConfigurationError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - work_item_configuration_properties: _models.WorkItemCreateConfiguration, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Create a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_configuration_properties: Properties that need to be specified to create a - work item configuration of a Application Insights component. Required. - :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - resource_name: str, - work_item_configuration_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Create a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_configuration_properties: Properties that need to be specified to create a - work item configuration of a Application Insights component. Required. - :type work_item_configuration_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - resource_name: str, - work_item_configuration_properties: Union[_models.WorkItemCreateConfiguration, IO[bytes]], - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Create a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_configuration_properties: Properties that need to be specified to create a - work item configuration of a Application Insights component. Is either a - WorkItemCreateConfiguration type or a IO[bytes] type. Required. - :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration or IO[bytes] - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(work_item_configuration_properties, (IOBase, bytes)): - _content = work_item_configuration_properties - else: - _json = self._serialize.body(work_item_configuration_properties, "WorkItemCreateConfiguration") - - _request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkItemConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_default( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Gets default work item configurations that exist for the application. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) - - _request = build_get_default_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkItemConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, resource_group_name: str, resource_name: str, work_item_config_id: str, **kwargs: Any - ) -> None: - """Delete a work item configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_config_id: The unique work item configuration Id. This can be either friendly - name of connector as defined in connector configuration. Required. - :type work_item_config_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - work_item_config_id=work_item_config_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get_item( - self, resource_group_name: str, resource_name: str, work_item_config_id: str, **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Gets specified work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_config_id: The unique work item configuration Id. This can be either friendly - name of connector as defined in connector configuration. Required. - :type work_item_config_id: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) - - _request = build_get_item_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - work_item_config_id=work_item_config_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkItemConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_item( - self, - resource_group_name: str, - resource_name: str, - work_item_config_id: str, - work_item_configuration_properties: _models.WorkItemCreateConfiguration, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Update a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_config_id: The unique work item configuration Id. This can be either friendly - name of connector as defined in connector configuration. Required. - :type work_item_config_id: str - :param work_item_configuration_properties: Properties that need to be specified to update a - work item configuration for this Application Insights component. Required. - :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_item( - self, - resource_group_name: str, - resource_name: str, - work_item_config_id: str, - work_item_configuration_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Update a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_config_id: The unique work item configuration Id. This can be either friendly - name of connector as defined in connector configuration. Required. - :type work_item_config_id: str - :param work_item_configuration_properties: Properties that need to be specified to update a - work item configuration for this Application Insights component. Required. - :type work_item_configuration_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_item( - self, - resource_group_name: str, - resource_name: str, - work_item_config_id: str, - work_item_configuration_properties: Union[_models.WorkItemCreateConfiguration, IO[bytes]], - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Update a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_config_id: The unique work item configuration Id. This can be either friendly - name of connector as defined in connector configuration. Required. - :type work_item_config_id: str - :param work_item_configuration_properties: Properties that need to be specified to update a - work item configuration for this Application Insights component. Is either a - WorkItemCreateConfiguration type or a IO[bytes] type. Required. - :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration or IO[bytes] - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(work_item_configuration_properties, (IOBase, bytes)): - _content = work_item_configuration_properties - else: - _json = self._serialize.body(work_item_configuration_properties, "WorkItemCreateConfiguration") - - _request = build_update_item_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - work_item_config_id=work_item_config_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkItemConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_workbooks_operations.py deleted file mode 100644 index 1288f332511b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/aio/operations/_workbooks_operations.py +++ /dev/null @@ -1,555 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._workbooks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.aio.ApplicationInsightsManagementClient`'s - :attr:`workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Workbook: - """Get a single workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Delete a workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.Workbook, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.Workbook, IO[bytes]], - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. Is - either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook or - IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "Workbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.Workbook, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.Workbook, IO[bytes]], - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. Is - either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook or - IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "Workbook") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_application_insights_management_client_enums.py deleted file mode 100644 index 2a149254cbfb..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_application_insights_management_client_enums.py +++ /dev/null @@ -1,129 +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 ApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application being monitored.""" - - WEB = "web" - OTHER = "other" - - -class CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """CategoryType.""" - - WORKBOOK = "workbook" - TSG = "TSG" - PERFORMANCE = "performance" - RETENTION = "retention" - - -class FavoriteSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """FavoriteSourceType.""" - - RETENTION = "retention" - NOTEBOOK = "notebook" - SESSIONS = "sessions" - EVENTS = "events" - USERFLOWS = "userflows" - FUNNEL = "funnel" - IMPACT = "impact" - SEGMENTATION = "segmentation" - - -class FavoriteType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum indicating if this favorite definition is owned by a specific user or is shared between - all users with access to the Application Insights component. - """ - - SHARED = "shared" - USER = "user" - - -class FlowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Used by the Application Insights system to determine what kind of flow this component was - created by. This is to be set to 'Bluefield' when creating/updating a component via the REST - API. - """ - - BLUEFIELD = "Bluefield" - - -class IngestionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates the flow of the ingestion.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS = "ApplicationInsightsWithDiagnosticSettings" - LOG_ANALYTICS = "LogAnalytics" - - -class ItemScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum indicating if this item definition is owned by a specific user or is shared between all - users with access to the Application Insights component. - """ - - SHARED = "shared" - USER = "user" - - -class ItemScopePath(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ItemScopePath.""" - - ANALYTICS_ITEMS = "analyticsItems" - MYANALYTICS_ITEMS = "myanalyticsItems" - - -class ItemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum indicating the type of the Analytics item.""" - - NONE = "none" - QUERY = "query" - RECENT = "recent" - FUNCTION = "function" - - -class ItemTypeParameter(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ItemTypeParameter.""" - - NONE = "none" - QUERY = "query" - FUNCTION = "function" - FOLDER = "folder" - RECENT = "recent" - - -class PurgeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the operation represented by the requested Id.""" - - PENDING = "pending" - COMPLETED = "completed" - - -class RequestSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Describes what tool created this Application Insights component. Customers using this API - should set this to the default 'rest'. - """ - - REST = "rest" - - -class SharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of workbook. Choices are user and shared.""" - - USER = "user" - SHARED = "shared" - - -class WebTestKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of web test that this web test watches. Choices are ping and multistep.""" - - PING = "ping" - MULTISTEP = "multistep" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_models_py3.py deleted file mode 100644 index f89094e755da..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/models/_models_py3.py +++ /dev/null @@ -1,2903 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class Annotation(_serialization.Model): - """Annotation associated with an application insights resource. - - :ivar annotation_name: Name of annotation. - :vartype annotation_name: str - :ivar category: Category of annotation, free form. - :vartype category: str - :ivar event_time: Time when event occurred. - :vartype event_time: ~datetime.datetime - :ivar id: Unique Id for annotation. - :vartype id: str - :ivar properties: Serialized JSON object for detailed properties. - :vartype properties: str - :ivar related_annotation: Related parent annotation if any. - :vartype related_annotation: str - """ - - _attribute_map = { - "annotation_name": {"key": "AnnotationName", "type": "str"}, - "category": {"key": "Category", "type": "str"}, - "event_time": {"key": "EventTime", "type": "iso-8601"}, - "id": {"key": "Id", "type": "str"}, - "properties": {"key": "Properties", "type": "str"}, - "related_annotation": {"key": "RelatedAnnotation", "type": "str"}, - } - - def __init__( - self, - *, - annotation_name: Optional[str] = None, - category: Optional[str] = None, - event_time: Optional[datetime.datetime] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - properties: Optional[str] = None, - related_annotation: str = "null", - **kwargs: Any - ) -> None: - """ - :keyword annotation_name: Name of annotation. - :paramtype annotation_name: str - :keyword category: Category of annotation, free form. - :paramtype category: str - :keyword event_time: Time when event occurred. - :paramtype event_time: ~datetime.datetime - :keyword id: Unique Id for annotation. - :paramtype id: str - :keyword properties: Serialized JSON object for detailed properties. - :paramtype properties: str - :keyword related_annotation: Related parent annotation if any. - :paramtype related_annotation: str - """ - super().__init__(**kwargs) - self.annotation_name = annotation_name - self.category = category - self.event_time = event_time - self.id = id - self.properties = properties - self.related_annotation = related_annotation - - -class AnnotationError(_serialization.Model): - """Error associated with trying to create annotation with Id that already exist. - - :ivar code: Error detail code and explanation. - :vartype code: str - :ivar message: Error message. - :vartype message: str - :ivar innererror: Inner error. - :vartype innererror: ~azure.mgmt.applicationinsights.v2015_05_01.models.InnerError - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "innererror": {"key": "innererror", "type": "InnerError"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - innererror: Optional["_models.InnerError"] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Error detail code and explanation. - :paramtype code: str - :keyword message: Error message. - :paramtype message: str - :keyword innererror: Inner error. - :paramtype innererror: ~azure.mgmt.applicationinsights.v2015_05_01.models.InnerError - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.innererror = innererror - - -class AnnotationsListResult(_serialization.Model): - """Annotations list result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: An array of annotations. - :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Annotation]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[list["_models.Annotation"]] = None - - -class APIKeyRequest(_serialization.Model): - """An Application Insights component API Key creation request definition. - - :ivar name: The name of the API Key. - :vartype name: str - :ivar linked_read_properties: The read access rights of this API Key. - :vartype linked_read_properties: list[str] - :ivar linked_write_properties: The write access rights of this API Key. - :vartype linked_write_properties: list[str] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "linked_read_properties": {"key": "linkedReadProperties", "type": "[str]"}, - "linked_write_properties": {"key": "linkedWriteProperties", "type": "[str]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - linked_read_properties: Optional[list[str]] = None, - linked_write_properties: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the API Key. - :paramtype name: str - :keyword linked_read_properties: The read access rights of this API Key. - :paramtype linked_read_properties: list[str] - :keyword linked_write_properties: The write access rights of this API Key. - :paramtype linked_write_properties: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.linked_read_properties = linked_read_properties - self.linked_write_properties = linked_write_properties - - -class ComponentsResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class ApplicationInsightsComponent(ComponentsResource): - """An Application Insights component definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: The kind of application that this component refers to, used to customize UI. This - value is a freeform string, values should typically be one of the following: web, ios, other, - store, java, phone. Required. - :vartype kind: str - :ivar application_id: The unique ID of your application. This field mirrors the 'Name' field - and cannot be changed. - :vartype application_id: str - :ivar app_id: Application Insights Unique ID for your Application. - :vartype app_id: str - :ivar application_type: Type of application being monitored. Known values are: "web" and - "other". - :vartype application_type: str or - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationType - :ivar flow_type: Used by the Application Insights system to determine what kind of flow this - component was created by. This is to be set to 'Bluefield' when creating/updating a component - via the REST API. "Bluefield" - :vartype flow_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FlowType - :ivar request_source: Describes what tool created this Application Insights component. - Customers using this API should set this to the default 'rest'. "rest" - :vartype request_source: str or - ~azure.mgmt.applicationinsights.v2015_05_01.models.RequestSource - :ivar instrumentation_key: Application Insights Instrumentation key. A read-only value that - applications can use to identify the destination for all telemetry sent to Azure Application - Insights. This value will be supplied upon construction of each new Application Insights - component. - :vartype instrumentation_key: str - :ivar creation_date: Creation Date for the Application Insights component, in ISO 8601 format. - :vartype creation_date: ~datetime.datetime - :ivar tenant_id: Azure Tenant Id. - :vartype tenant_id: str - :ivar hockey_app_id: The unique application ID created when a new application is added to - HockeyApp, used for communications with HockeyApp. - :vartype hockey_app_id: str - :ivar hockey_app_token: Token used to authenticate communications with between Application - Insights and HockeyApp. - :vartype hockey_app_token: str - :ivar provisioning_state: Current state of this component: whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. - :vartype provisioning_state: str - :ivar sampling_percentage: Percentage of the data produced by the application being monitored - that is being sampled for Application Insights telemetry. - :vartype sampling_percentage: float - :ivar connection_string: Application Insights component connection string. - :vartype connection_string: str - :ivar retention_in_days: Retention period in days. - :vartype retention_in_days: int - :ivar disable_ip_masking: Disable IP masking. - :vartype disable_ip_masking: bool - :ivar immediate_purge_data_on30_days: Purge data immediately after 30 days. - :vartype immediate_purge_data_on30_days: bool - :ivar private_link_scoped_resources: List of linked private link scope resources. - :vartype private_link_scoped_resources: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.PrivateLinkScopedResource] - :ivar ingestion_mode: Indicates the flow of the ingestion. Known values are: - "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". - :vartype ingestion_mode: str or - ~azure.mgmt.applicationinsights.v2015_05_01.models.IngestionMode - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "kind": {"required": True}, - "application_id": {"readonly": True}, - "app_id": {"readonly": True}, - "instrumentation_key": {"readonly": True}, - "creation_date": {"readonly": True}, - "tenant_id": {"readonly": True}, - "hockey_app_token": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "connection_string": {"readonly": True}, - "private_link_scoped_resources": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "application_id": {"key": "properties.ApplicationId", "type": "str"}, - "app_id": {"key": "properties.AppId", "type": "str"}, - "application_type": {"key": "properties.Application_Type", "type": "str"}, - "flow_type": {"key": "properties.Flow_Type", "type": "str"}, - "request_source": {"key": "properties.Request_Source", "type": "str"}, - "instrumentation_key": {"key": "properties.InstrumentationKey", "type": "str"}, - "creation_date": {"key": "properties.CreationDate", "type": "iso-8601"}, - "tenant_id": {"key": "properties.TenantId", "type": "str"}, - "hockey_app_id": {"key": "properties.HockeyAppId", "type": "str"}, - "hockey_app_token": {"key": "properties.HockeyAppToken", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "sampling_percentage": {"key": "properties.SamplingPercentage", "type": "float"}, - "connection_string": {"key": "properties.ConnectionString", "type": "str"}, - "retention_in_days": {"key": "properties.RetentionInDays", "type": "int"}, - "disable_ip_masking": {"key": "properties.DisableIpMasking", "type": "bool"}, - "immediate_purge_data_on30_days": {"key": "properties.ImmediatePurgeDataOn30Days", "type": "bool"}, - "private_link_scoped_resources": { - "key": "properties.PrivateLinkScopedResources", - "type": "[PrivateLinkScopedResource]", - }, - "ingestion_mode": {"key": "properties.IngestionMode", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - kind: str, - tags: Optional[dict[str, str]] = None, - application_type: Union[str, "_models.ApplicationType"] = "web", - flow_type: Union[str, "_models.FlowType"] = "Bluefield", - request_source: Union[str, "_models.RequestSource"] = "rest", - hockey_app_id: Optional[str] = None, - sampling_percentage: Optional[float] = None, - retention_in_days: int = 90, - disable_ip_masking: Optional[bool] = None, - immediate_purge_data_on30_days: Optional[bool] = None, - ingestion_mode: Union[str, "_models.IngestionMode"] = "ApplicationInsights", - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword kind: The kind of application that this component refers to, used to customize UI. - This value is a freeform string, values should typically be one of the following: web, ios, - other, store, java, phone. Required. - :paramtype kind: str - :keyword application_type: Type of application being monitored. Known values are: "web" and - "other". - :paramtype application_type: str or - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationType - :keyword flow_type: Used by the Application Insights system to determine what kind of flow this - component was created by. This is to be set to 'Bluefield' when creating/updating a component - via the REST API. "Bluefield" - :paramtype flow_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FlowType - :keyword request_source: Describes what tool created this Application Insights component. - Customers using this API should set this to the default 'rest'. "rest" - :paramtype request_source: str or - ~azure.mgmt.applicationinsights.v2015_05_01.models.RequestSource - :keyword hockey_app_id: The unique application ID created when a new application is added to - HockeyApp, used for communications with HockeyApp. - :paramtype hockey_app_id: str - :keyword sampling_percentage: Percentage of the data produced by the application being - monitored that is being sampled for Application Insights telemetry. - :paramtype sampling_percentage: float - :keyword retention_in_days: Retention period in days. - :paramtype retention_in_days: int - :keyword disable_ip_masking: Disable IP masking. - :paramtype disable_ip_masking: bool - :keyword immediate_purge_data_on30_days: Purge data immediately after 30 days. - :paramtype immediate_purge_data_on30_days: bool - :keyword ingestion_mode: Indicates the flow of the ingestion. Known values are: - "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". - :paramtype ingestion_mode: str or - ~azure.mgmt.applicationinsights.v2015_05_01.models.IngestionMode - """ - super().__init__(location=location, tags=tags, **kwargs) - self.kind = kind - self.application_id: Optional[str] = None - self.app_id: Optional[str] = None - self.application_type = application_type - self.flow_type = flow_type - self.request_source = request_source - self.instrumentation_key: Optional[str] = None - self.creation_date: Optional[datetime.datetime] = None - self.tenant_id: Optional[str] = None - self.hockey_app_id = hockey_app_id - self.hockey_app_token: Optional[str] = None - self.provisioning_state: Optional[str] = None - self.sampling_percentage = sampling_percentage - self.connection_string: Optional[str] = None - self.retention_in_days = retention_in_days - self.disable_ip_masking = disable_ip_masking - self.immediate_purge_data_on30_days = immediate_purge_data_on30_days - self.private_link_scoped_resources: Optional[list["_models.PrivateLinkScopedResource"]] = None - self.ingestion_mode = ingestion_mode - - -class ApplicationInsightsComponentAnalyticsItem(_serialization.Model): # pylint: disable=name-too-long - """Properties that define an Analytics item that is associated to an Application Insights - component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Internally assigned unique id of the item definition. - :vartype id: str - :ivar name: The user-defined name of the item. - :vartype name: str - :ivar content: The content of this item. - :vartype content: str - :ivar version: This instance's version of the data model. This can change as new features are - added. - :vartype version: str - :ivar scope: Enum indicating if this item definition is owned by a specific user or is shared - between all users with access to the Application Insights component. Known values are: "shared" - and "user". - :vartype scope: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScope - :ivar type: Enum indicating the type of the Analytics item. Known values are: "none", "query", - "recent", and "function". - :vartype type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemType - :ivar time_created: Date and time in UTC when this item was created. - :vartype time_created: str - :ivar time_modified: Date and time in UTC of the last modification that was made to this item. - :vartype time_modified: str - :ivar properties: A set of properties that can be defined in the context of a specific item - type. Each type may have its own properties. - :vartype properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItemProperties - """ - - _validation = { - "version": {"readonly": True}, - "time_created": {"readonly": True}, - "time_modified": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "Id", "type": "str"}, - "name": {"key": "Name", "type": "str"}, - "content": {"key": "Content", "type": "str"}, - "version": {"key": "Version", "type": "str"}, - "scope": {"key": "Scope", "type": "str"}, - "type": {"key": "Type", "type": "str"}, - "time_created": {"key": "TimeCreated", "type": "str"}, - "time_modified": {"key": "TimeModified", "type": "str"}, - "properties": {"key": "Properties", "type": "ApplicationInsightsComponentAnalyticsItemProperties"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - content: Optional[str] = None, - scope: Optional[Union[str, "_models.ItemScope"]] = None, - type: Optional[Union[str, "_models.ItemType"]] = None, - properties: Optional["_models.ApplicationInsightsComponentAnalyticsItemProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Internally assigned unique id of the item definition. - :paramtype id: str - :keyword name: The user-defined name of the item. - :paramtype name: str - :keyword content: The content of this item. - :paramtype content: str - :keyword scope: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "shared" and "user". - :paramtype scope: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScope - :keyword type: Enum indicating the type of the Analytics item. Known values are: "none", - "query", "recent", and "function". - :paramtype type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemType - :keyword properties: A set of properties that can be defined in the context of a specific item - type. Each type may have its own properties. - :paramtype properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItemProperties - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.content = content - self.version: Optional[str] = None - self.scope = scope - self.type = type - self.time_created: Optional[str] = None - self.time_modified: Optional[str] = None - self.properties = properties - - -class ApplicationInsightsComponentAnalyticsItemProperties(_serialization.Model): # pylint: disable=name-too-long - """A set of properties that can be defined in the context of a specific item type. Each type may - have its own properties. - - :ivar function_alias: A function alias, used when the type of the item is Function. - :vartype function_alias: str - """ - - _attribute_map = { - "function_alias": {"key": "functionAlias", "type": "str"}, - } - - def __init__(self, *, function_alias: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword function_alias: A function alias, used when the type of the item is Function. - :paramtype function_alias: str - """ - super().__init__(**kwargs) - self.function_alias = function_alias - - -class ApplicationInsightsComponentAPIKey(_serialization.Model): - """Properties that define an API key of an Application Insights Component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The unique ID of the API key inside an Application Insights component. It is auto - generated when the API key is created. - :vartype id: str - :ivar api_key: The API key value. It will be only return once when the API Key was created. - :vartype api_key: str - :ivar created_date: The create date of this API key. - :vartype created_date: str - :ivar name: The name of the API key. - :vartype name: str - :ivar linked_read_properties: The read access rights of this API Key. - :vartype linked_read_properties: list[str] - :ivar linked_write_properties: The write access rights of this API Key. - :vartype linked_write_properties: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "api_key": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "api_key": {"key": "apiKey", "type": "str"}, - "created_date": {"key": "createdDate", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "linked_read_properties": {"key": "linkedReadProperties", "type": "[str]"}, - "linked_write_properties": {"key": "linkedWriteProperties", "type": "[str]"}, - } - - def __init__( - self, - *, - created_date: Optional[str] = None, - name: Optional[str] = None, - linked_read_properties: Optional[list[str]] = None, - linked_write_properties: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_date: The create date of this API key. - :paramtype created_date: str - :keyword name: The name of the API key. - :paramtype name: str - :keyword linked_read_properties: The read access rights of this API Key. - :paramtype linked_read_properties: list[str] - :keyword linked_write_properties: The write access rights of this API Key. - :paramtype linked_write_properties: list[str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.api_key: Optional[str] = None - self.created_date = created_date - self.name = name - self.linked_read_properties = linked_read_properties - self.linked_write_properties = linked_write_properties - - -class ApplicationInsightsComponentAPIKeyListResult(_serialization.Model): # pylint: disable=name-too-long - """Describes the list of API Keys of an Application Insights Component. - - All required parameters must be populated in order to send to server. - - :ivar value: List of API Key definitions. Required. - :vartype value: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationInsightsComponentAPIKey]"}, - } - - def __init__(self, *, value: list["_models.ApplicationInsightsComponentAPIKey"], **kwargs: Any) -> None: - """ - :keyword value: List of API Key definitions. Required. - :paramtype value: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey] - """ - super().__init__(**kwargs) - self.value = value - - -class ApplicationInsightsComponentAvailableFeatures(_serialization.Model): # pylint: disable=name-too-long - """An Application Insights component available features. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar result: A list of Application Insights component feature. - :vartype result: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFeature] - """ - - _validation = { - "result": {"readonly": True}, - } - - _attribute_map = { - "result": {"key": "Result", "type": "[ApplicationInsightsComponentFeature]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.result: Optional[list["_models.ApplicationInsightsComponentFeature"]] = None - - -class ApplicationInsightsComponentBillingFeatures(_serialization.Model): # pylint: disable=name-too-long - """An Application Insights component billing features. - - :ivar data_volume_cap: An Application Insights component daily data volume cap. - :vartype data_volume_cap: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentDataVolumeCap - :ivar current_billing_features: Current enabled pricing plan. When the component is in the - Enterprise plan, this will list both 'Basic' and 'Application Insights Enterprise'. - :vartype current_billing_features: list[str] - """ - - _attribute_map = { - "data_volume_cap": {"key": "DataVolumeCap", "type": "ApplicationInsightsComponentDataVolumeCap"}, - "current_billing_features": {"key": "CurrentBillingFeatures", "type": "[str]"}, - } - - def __init__( - self, - *, - data_volume_cap: Optional["_models.ApplicationInsightsComponentDataVolumeCap"] = None, - current_billing_features: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword data_volume_cap: An Application Insights component daily data volume cap. - :paramtype data_volume_cap: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentDataVolumeCap - :keyword current_billing_features: Current enabled pricing plan. When the component is in the - Enterprise plan, this will list both 'Basic' and 'Application Insights Enterprise'. - :paramtype current_billing_features: list[str] - """ - super().__init__(**kwargs) - self.data_volume_cap = data_volume_cap - self.current_billing_features = current_billing_features - - -class ApplicationInsightsComponentDataVolumeCap(_serialization.Model): # pylint: disable=name-too-long - """An Application Insights component daily data volume cap. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cap: Daily data volume cap in GB. - :vartype cap: float - :ivar reset_time: Daily data volume cap UTC reset hour. - :vartype reset_time: int - :ivar warning_threshold: Reserved, not used for now. - :vartype warning_threshold: int - :ivar stop_send_notification_when_hit_threshold: Reserved, not used for now. - :vartype stop_send_notification_when_hit_threshold: bool - :ivar stop_send_notification_when_hit_cap: Do not send a notification email when the daily data - volume cap is met. - :vartype stop_send_notification_when_hit_cap: bool - :ivar max_history_cap: Maximum daily data volume cap that the user can set for this component. - :vartype max_history_cap: float - """ - - _validation = { - "reset_time": {"readonly": True}, - "max_history_cap": {"readonly": True}, - } - - _attribute_map = { - "cap": {"key": "Cap", "type": "float"}, - "reset_time": {"key": "ResetTime", "type": "int"}, - "warning_threshold": {"key": "WarningThreshold", "type": "int"}, - "stop_send_notification_when_hit_threshold": {"key": "StopSendNotificationWhenHitThreshold", "type": "bool"}, - "stop_send_notification_when_hit_cap": {"key": "StopSendNotificationWhenHitCap", "type": "bool"}, - "max_history_cap": {"key": "MaxHistoryCap", "type": "float"}, - } - - def __init__( - self, - *, - cap: Optional[float] = None, - warning_threshold: Optional[int] = None, - stop_send_notification_when_hit_threshold: Optional[bool] = None, - stop_send_notification_when_hit_cap: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword cap: Daily data volume cap in GB. - :paramtype cap: float - :keyword warning_threshold: Reserved, not used for now. - :paramtype warning_threshold: int - :keyword stop_send_notification_when_hit_threshold: Reserved, not used for now. - :paramtype stop_send_notification_when_hit_threshold: bool - :keyword stop_send_notification_when_hit_cap: Do not send a notification email when the daily - data volume cap is met. - :paramtype stop_send_notification_when_hit_cap: bool - """ - super().__init__(**kwargs) - self.cap = cap - self.reset_time: Optional[int] = None - self.warning_threshold = warning_threshold - self.stop_send_notification_when_hit_threshold = stop_send_notification_when_hit_threshold - self.stop_send_notification_when_hit_cap = stop_send_notification_when_hit_cap - self.max_history_cap: Optional[float] = None - - -class ApplicationInsightsComponentExportConfiguration(_serialization.Model): # pylint: disable=name-too-long - """Properties that define a Continuous Export configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar export_id: The unique ID of the export configuration inside an Application Insights - component. It is auto generated when the Continuous Export configuration is created. - :vartype export_id: str - :ivar instrumentation_key: The instrumentation key of the Application Insights component. - :vartype instrumentation_key: str - :ivar record_types: This comma separated list of document types that will be exported. The - possible values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', - 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. - :vartype record_types: str - :ivar application_name: The name of the Application Insights component. - :vartype application_name: str - :ivar subscription_id: The subscription of the Application Insights component. - :vartype subscription_id: str - :ivar resource_group: The resource group of the Application Insights component. - :vartype resource_group: str - :ivar destination_storage_subscription_id: The destination storage account subscription ID. - :vartype destination_storage_subscription_id: str - :ivar destination_storage_location_id: The destination account location ID. - :vartype destination_storage_location_id: str - :ivar destination_account_id: The name of destination account. - :vartype destination_account_id: str - :ivar destination_type: The destination type. - :vartype destination_type: str - :ivar is_user_enabled: This will be 'true' if the Continuous Export configuration is enabled, - otherwise it will be 'false'. - :vartype is_user_enabled: str - :ivar last_user_update: Last time the Continuous Export configuration was updated. - :vartype last_user_update: str - :ivar notification_queue_enabled: Deprecated. - :vartype notification_queue_enabled: str - :ivar export_status: This indicates current Continuous Export configuration status. The - possible values are 'Preparing', 'Success', 'Failure'. - :vartype export_status: str - :ivar last_success_time: The last time data was successfully delivered to the destination - storage container for this Continuous Export configuration. - :vartype last_success_time: str - :ivar last_gap_time: The last time the Continuous Export configuration started failing. - :vartype last_gap_time: str - :ivar permanent_error_reason: This is the reason the Continuous Export configuration started - failing. It can be 'AzureStorageNotFound' or 'AzureStorageAccessDenied'. - :vartype permanent_error_reason: str - :ivar storage_name: The name of the destination storage account. - :vartype storage_name: str - :ivar container_name: The name of the destination storage container. - :vartype container_name: str - """ - - _validation = { - "export_id": {"readonly": True}, - "instrumentation_key": {"readonly": True}, - "application_name": {"readonly": True}, - "subscription_id": {"readonly": True}, - "resource_group": {"readonly": True}, - "destination_storage_subscription_id": {"readonly": True}, - "destination_storage_location_id": {"readonly": True}, - "destination_account_id": {"readonly": True}, - "destination_type": {"readonly": True}, - "is_user_enabled": {"readonly": True}, - "last_user_update": {"readonly": True}, - "export_status": {"readonly": True}, - "last_success_time": {"readonly": True}, - "last_gap_time": {"readonly": True}, - "permanent_error_reason": {"readonly": True}, - "storage_name": {"readonly": True}, - "container_name": {"readonly": True}, - } - - _attribute_map = { - "export_id": {"key": "ExportId", "type": "str"}, - "instrumentation_key": {"key": "InstrumentationKey", "type": "str"}, - "record_types": {"key": "RecordTypes", "type": "str"}, - "application_name": {"key": "ApplicationName", "type": "str"}, - "subscription_id": {"key": "SubscriptionId", "type": "str"}, - "resource_group": {"key": "ResourceGroup", "type": "str"}, - "destination_storage_subscription_id": {"key": "DestinationStorageSubscriptionId", "type": "str"}, - "destination_storage_location_id": {"key": "DestinationStorageLocationId", "type": "str"}, - "destination_account_id": {"key": "DestinationAccountId", "type": "str"}, - "destination_type": {"key": "DestinationType", "type": "str"}, - "is_user_enabled": {"key": "IsUserEnabled", "type": "str"}, - "last_user_update": {"key": "LastUserUpdate", "type": "str"}, - "notification_queue_enabled": {"key": "NotificationQueueEnabled", "type": "str"}, - "export_status": {"key": "ExportStatus", "type": "str"}, - "last_success_time": {"key": "LastSuccessTime", "type": "str"}, - "last_gap_time": {"key": "LastGapTime", "type": "str"}, - "permanent_error_reason": {"key": "PermanentErrorReason", "type": "str"}, - "storage_name": {"key": "StorageName", "type": "str"}, - "container_name": {"key": "ContainerName", "type": "str"}, - } - - def __init__( - self, *, record_types: Optional[str] = None, notification_queue_enabled: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword record_types: This comma separated list of document types that will be exported. The - possible values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', - 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. - :paramtype record_types: str - :keyword notification_queue_enabled: Deprecated. - :paramtype notification_queue_enabled: str - """ - super().__init__(**kwargs) - self.export_id: Optional[str] = None - self.instrumentation_key: Optional[str] = None - self.record_types = record_types - self.application_name: Optional[str] = None - self.subscription_id: Optional[str] = None - self.resource_group: Optional[str] = None - self.destination_storage_subscription_id: Optional[str] = None - self.destination_storage_location_id: Optional[str] = None - self.destination_account_id: Optional[str] = None - self.destination_type: Optional[str] = None - self.is_user_enabled: Optional[str] = None - self.last_user_update: Optional[str] = None - self.notification_queue_enabled = notification_queue_enabled - self.export_status: Optional[str] = None - self.last_success_time: Optional[str] = None - self.last_gap_time: Optional[str] = None - self.permanent_error_reason: Optional[str] = None - self.storage_name: Optional[str] = None - self.container_name: Optional[str] = None - - -class ApplicationInsightsComponentExportRequest(_serialization.Model): # pylint: disable=name-too-long - """An Application Insights component Continuous Export configuration request definition. - - :ivar record_types: The document types to be exported, as comma separated values. Allowed - values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', - 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. - :vartype record_types: str - :ivar destination_type: The Continuous Export destination type. This has to be 'Blob'. - :vartype destination_type: str - :ivar destination_address: The SAS URL for the destination storage container. It must grant - write permission. - :vartype destination_address: str - :ivar is_enabled: Set to 'true' to create a Continuous Export configuration as enabled, - otherwise set it to 'false'. - :vartype is_enabled: str - :ivar notification_queue_enabled: Deprecated. - :vartype notification_queue_enabled: str - :ivar notification_queue_uri: Deprecated. - :vartype notification_queue_uri: str - :ivar destination_storage_subscription_id: The subscription ID of the destination storage - container. - :vartype destination_storage_subscription_id: str - :ivar destination_storage_location_id: The location ID of the destination storage container. - :vartype destination_storage_location_id: str - :ivar destination_account_id: The name of destination storage account. - :vartype destination_account_id: str - """ - - _attribute_map = { - "record_types": {"key": "RecordTypes", "type": "str"}, - "destination_type": {"key": "DestinationType", "type": "str"}, - "destination_address": {"key": "DestinationAddress", "type": "str"}, - "is_enabled": {"key": "IsEnabled", "type": "str"}, - "notification_queue_enabled": {"key": "NotificationQueueEnabled", "type": "str"}, - "notification_queue_uri": {"key": "NotificationQueueUri", "type": "str"}, - "destination_storage_subscription_id": {"key": "DestinationStorageSubscriptionId", "type": "str"}, - "destination_storage_location_id": {"key": "DestinationStorageLocationId", "type": "str"}, - "destination_account_id": {"key": "DestinationAccountId", "type": "str"}, - } - - def __init__( - self, - *, - record_types: Optional[str] = None, - destination_type: Optional[str] = None, - destination_address: Optional[str] = None, - is_enabled: Optional[str] = None, - notification_queue_enabled: Optional[str] = None, - notification_queue_uri: Optional[str] = None, - destination_storage_subscription_id: Optional[str] = None, - destination_storage_location_id: Optional[str] = None, - destination_account_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword record_types: The document types to be exported, as comma separated values. Allowed - values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', - 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. - :paramtype record_types: str - :keyword destination_type: The Continuous Export destination type. This has to be 'Blob'. - :paramtype destination_type: str - :keyword destination_address: The SAS URL for the destination storage container. It must grant - write permission. - :paramtype destination_address: str - :keyword is_enabled: Set to 'true' to create a Continuous Export configuration as enabled, - otherwise set it to 'false'. - :paramtype is_enabled: str - :keyword notification_queue_enabled: Deprecated. - :paramtype notification_queue_enabled: str - :keyword notification_queue_uri: Deprecated. - :paramtype notification_queue_uri: str - :keyword destination_storage_subscription_id: The subscription ID of the destination storage - container. - :paramtype destination_storage_subscription_id: str - :keyword destination_storage_location_id: The location ID of the destination storage container. - :paramtype destination_storage_location_id: str - :keyword destination_account_id: The name of destination storage account. - :paramtype destination_account_id: str - """ - super().__init__(**kwargs) - self.record_types = record_types - self.destination_type = destination_type - self.destination_address = destination_address - self.is_enabled = is_enabled - self.notification_queue_enabled = notification_queue_enabled - self.notification_queue_uri = notification_queue_uri - self.destination_storage_subscription_id = destination_storage_subscription_id - self.destination_storage_location_id = destination_storage_location_id - self.destination_account_id = destination_account_id - - -class ApplicationInsightsComponentFavorite(_serialization.Model): - """Properties that define a favorite that is associated to an Application Insights component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The user-defined name of the favorite. - :vartype name: str - :ivar config: Configuration of this particular favorite, which are driven by the Azure portal - UX. Configuration data is a string containing valid JSON. - :vartype config: str - :ivar version: This instance's version of the data model. This can change as new features are - added that can be marked favorite. Current examples include MetricsExplorer (ME) and Search. - :vartype version: str - :ivar favorite_id: Internally assigned unique id of the favorite definition. - :vartype favorite_id: str - :ivar favorite_type: Enum indicating if this favorite definition is owned by a specific user or - is shared between all users with access to the Application Insights component. Known values - are: "shared" and "user". - :vartype favorite_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteType - :ivar source_type: The source of the favorite definition. - :vartype source_type: str - :ivar time_modified: Date and time in UTC of the last modification that was made to this - favorite definition. - :vartype time_modified: str - :ivar tags: A list of 0 or more tags that are associated with this favorite definition. - :vartype tags: list[str] - :ivar category: Favorite category, as defined by the user at creation time. - :vartype category: str - :ivar is_generated_from_template: Flag denoting wether or not this favorite was generated from - a template. - :vartype is_generated_from_template: bool - :ivar user_id: Unique user id of the specific user that owns this favorite. - :vartype user_id: str - """ - - _validation = { - "favorite_id": {"readonly": True}, - "time_modified": {"readonly": True}, - "user_id": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "Name", "type": "str"}, - "config": {"key": "Config", "type": "str"}, - "version": {"key": "Version", "type": "str"}, - "favorite_id": {"key": "FavoriteId", "type": "str"}, - "favorite_type": {"key": "FavoriteType", "type": "str"}, - "source_type": {"key": "SourceType", "type": "str"}, - "time_modified": {"key": "TimeModified", "type": "str"}, - "tags": {"key": "Tags", "type": "[str]"}, - "category": {"key": "Category", "type": "str"}, - "is_generated_from_template": {"key": "IsGeneratedFromTemplate", "type": "bool"}, - "user_id": {"key": "UserId", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - config: Optional[str] = None, - version: Optional[str] = None, - favorite_type: Optional[Union[str, "_models.FavoriteType"]] = None, - source_type: Optional[str] = None, - tags: Optional[list[str]] = None, - category: Optional[str] = None, - is_generated_from_template: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The user-defined name of the favorite. - :paramtype name: str - :keyword config: Configuration of this particular favorite, which are driven by the Azure - portal UX. Configuration data is a string containing valid JSON. - :paramtype config: str - :keyword version: This instance's version of the data model. This can change as new features - are added that can be marked favorite. Current examples include MetricsExplorer (ME) and - Search. - :paramtype version: str - :keyword favorite_type: Enum indicating if this favorite definition is owned by a specific user - or is shared between all users with access to the Application Insights component. Known values - are: "shared" and "user". - :paramtype favorite_type: str or - ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteType - :keyword source_type: The source of the favorite definition. - :paramtype source_type: str - :keyword tags: A list of 0 or more tags that are associated with this favorite definition. - :paramtype tags: list[str] - :keyword category: Favorite category, as defined by the user at creation time. - :paramtype category: str - :keyword is_generated_from_template: Flag denoting wether or not this favorite was generated - from a template. - :paramtype is_generated_from_template: bool - """ - super().__init__(**kwargs) - self.name = name - self.config = config - self.version = version - self.favorite_id: Optional[str] = None - self.favorite_type = favorite_type - self.source_type = source_type - self.time_modified: Optional[str] = None - self.tags = tags - self.category = category - self.is_generated_from_template = is_generated_from_template - self.user_id: Optional[str] = None - - -class ApplicationInsightsComponentFeature(_serialization.Model): - """An Application Insights component daily data volume cap status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar feature_name: The pricing feature name. - :vartype feature_name: str - :ivar meter_id: The meter id used for the feature. - :vartype meter_id: str - :ivar meter_rate_frequency: The meter rate for the feature's meter. - :vartype meter_rate_frequency: str - :ivar resouce_id: Reserved, not used now. - :vartype resouce_id: str - :ivar is_hidden: Reserved, not used now. - :vartype is_hidden: bool - :ivar capabilities: A list of Application Insights component feature capability. - :vartype capabilities: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFeatureCapability] - :ivar title: Display name of the feature. - :vartype title: str - :ivar is_main_feature: Whether can apply addon feature on to it. - :vartype is_main_feature: bool - :ivar supported_addon_features: The add on features on main feature. - :vartype supported_addon_features: str - """ - - _validation = { - "feature_name": {"readonly": True}, - "meter_id": {"readonly": True}, - "meter_rate_frequency": {"readonly": True}, - "resouce_id": {"readonly": True}, - "is_hidden": {"readonly": True}, - "capabilities": {"readonly": True}, - "title": {"readonly": True}, - "is_main_feature": {"readonly": True}, - "supported_addon_features": {"readonly": True}, - } - - _attribute_map = { - "feature_name": {"key": "FeatureName", "type": "str"}, - "meter_id": {"key": "MeterId", "type": "str"}, - "meter_rate_frequency": {"key": "MeterRateFrequency", "type": "str"}, - "resouce_id": {"key": "ResouceId", "type": "str"}, - "is_hidden": {"key": "IsHidden", "type": "bool"}, - "capabilities": {"key": "Capabilities", "type": "[ApplicationInsightsComponentFeatureCapability]"}, - "title": {"key": "Title", "type": "str"}, - "is_main_feature": {"key": "IsMainFeature", "type": "bool"}, - "supported_addon_features": {"key": "SupportedAddonFeatures", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.feature_name: Optional[str] = None - self.meter_id: Optional[str] = None - self.meter_rate_frequency: Optional[str] = None - self.resouce_id: Optional[str] = None - self.is_hidden: Optional[bool] = None - self.capabilities: Optional[list["_models.ApplicationInsightsComponentFeatureCapability"]] = None - self.title: Optional[str] = None - self.is_main_feature: Optional[bool] = None - self.supported_addon_features: Optional[str] = None - - -class ApplicationInsightsComponentFeatureCapabilities(_serialization.Model): # pylint: disable=name-too-long - """An Application Insights component feature capabilities. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar support_export_data: Whether allow to use continuous export feature. - :vartype support_export_data: bool - :ivar burst_throttle_policy: Reserved, not used now. - :vartype burst_throttle_policy: str - :ivar metadata_class: Reserved, not used now. - :vartype metadata_class: str - :ivar live_stream_metrics: Reserved, not used now. - :vartype live_stream_metrics: bool - :ivar application_map: Reserved, not used now. - :vartype application_map: bool - :ivar work_item_integration: Whether allow to use work item integration feature. - :vartype work_item_integration: bool - :ivar power_bi_integration: Reserved, not used now. - :vartype power_bi_integration: bool - :ivar open_schema: Reserved, not used now. - :vartype open_schema: bool - :ivar proactive_detection: Reserved, not used now. - :vartype proactive_detection: bool - :ivar analytics_integration: Reserved, not used now. - :vartype analytics_integration: bool - :ivar multiple_step_web_test: Whether allow to use multiple steps web test feature. - :vartype multiple_step_web_test: bool - :ivar api_access_level: Reserved, not used now. - :vartype api_access_level: str - :ivar tracking_type: The application insights component used tracking type. - :vartype tracking_type: str - :ivar daily_cap: Daily data volume cap in GB. - :vartype daily_cap: float - :ivar daily_cap_reset_time: Daily data volume cap UTC reset hour. - :vartype daily_cap_reset_time: float - :ivar throttle_rate: Reserved, not used now. - :vartype throttle_rate: float - """ - - _validation = { - "support_export_data": {"readonly": True}, - "burst_throttle_policy": {"readonly": True}, - "metadata_class": {"readonly": True}, - "live_stream_metrics": {"readonly": True}, - "application_map": {"readonly": True}, - "work_item_integration": {"readonly": True}, - "power_bi_integration": {"readonly": True}, - "open_schema": {"readonly": True}, - "proactive_detection": {"readonly": True}, - "analytics_integration": {"readonly": True}, - "multiple_step_web_test": {"readonly": True}, - "api_access_level": {"readonly": True}, - "tracking_type": {"readonly": True}, - "daily_cap": {"readonly": True}, - "daily_cap_reset_time": {"readonly": True}, - "throttle_rate": {"readonly": True}, - } - - _attribute_map = { - "support_export_data": {"key": "SupportExportData", "type": "bool"}, - "burst_throttle_policy": {"key": "BurstThrottlePolicy", "type": "str"}, - "metadata_class": {"key": "MetadataClass", "type": "str"}, - "live_stream_metrics": {"key": "LiveStreamMetrics", "type": "bool"}, - "application_map": {"key": "ApplicationMap", "type": "bool"}, - "work_item_integration": {"key": "WorkItemIntegration", "type": "bool"}, - "power_bi_integration": {"key": "PowerBIIntegration", "type": "bool"}, - "open_schema": {"key": "OpenSchema", "type": "bool"}, - "proactive_detection": {"key": "ProactiveDetection", "type": "bool"}, - "analytics_integration": {"key": "AnalyticsIntegration", "type": "bool"}, - "multiple_step_web_test": {"key": "MultipleStepWebTest", "type": "bool"}, - "api_access_level": {"key": "ApiAccessLevel", "type": "str"}, - "tracking_type": {"key": "TrackingType", "type": "str"}, - "daily_cap": {"key": "DailyCap", "type": "float"}, - "daily_cap_reset_time": {"key": "DailyCapResetTime", "type": "float"}, - "throttle_rate": {"key": "ThrottleRate", "type": "float"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.support_export_data: Optional[bool] = None - self.burst_throttle_policy: Optional[str] = None - self.metadata_class: Optional[str] = None - self.live_stream_metrics: Optional[bool] = None - self.application_map: Optional[bool] = None - self.work_item_integration: Optional[bool] = None - self.power_bi_integration: Optional[bool] = None - self.open_schema: Optional[bool] = None - self.proactive_detection: Optional[bool] = None - self.analytics_integration: Optional[bool] = None - self.multiple_step_web_test: Optional[bool] = None - self.api_access_level: Optional[str] = None - self.tracking_type: Optional[str] = None - self.daily_cap: Optional[float] = None - self.daily_cap_reset_time: Optional[float] = None - self.throttle_rate: Optional[float] = None - - -class ApplicationInsightsComponentFeatureCapability(_serialization.Model): # pylint: disable=name-too-long - """An Application Insights component feature capability. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the capability. - :vartype name: str - :ivar description: The description of the capability. - :vartype description: str - :ivar value: The value of the capability. - :vartype value: str - :ivar unit: The unit of the capability. - :vartype unit: str - :ivar meter_id: The meter used for the capability. - :vartype meter_id: str - :ivar meter_rate_frequency: The meter rate of the meter. - :vartype meter_rate_frequency: str - """ - - _validation = { - "name": {"readonly": True}, - "description": {"readonly": True}, - "value": {"readonly": True}, - "unit": {"readonly": True}, - "meter_id": {"readonly": True}, - "meter_rate_frequency": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "Name", "type": "str"}, - "description": {"key": "Description", "type": "str"}, - "value": {"key": "Value", "type": "str"}, - "unit": {"key": "Unit", "type": "str"}, - "meter_id": {"key": "MeterId", "type": "str"}, - "meter_rate_frequency": {"key": "MeterRateFrequency", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.description: Optional[str] = None - self.value: Optional[str] = None - self.unit: Optional[str] = None - self.meter_id: Optional[str] = None - self.meter_rate_frequency: Optional[str] = None - - -class ApplicationInsightsComponentListResult(_serialization.Model): - """Describes the list of Application Insights Resources. - - All required parameters must be populated in order to send to server. - - :ivar value: List of Application Insights component definitions. Required. - :vartype value: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] - :ivar next_link: The URI to get the next set of Application Insights component definitions if - too many components where returned in the result set. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationInsightsComponent]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.ApplicationInsightsComponent"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of Application Insights component definitions. Required. - :paramtype value: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] - :keyword next_link: The URI to get the next set of Application Insights component definitions - if too many components where returned in the result set. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationInsightsComponentProactiveDetectionConfiguration( - _serialization.Model -): # pylint: disable=name-too-long - """Properties that define a ProactiveDetection configuration. - - :ivar name: The rule name. - :vartype name: str - :ivar enabled: A flag that indicates whether this rule is enabled by the user. - :vartype enabled: bool - :ivar send_emails_to_subscription_owners: A flag that indicated whether notifications on this - rule should be sent to subscription owners. - :vartype send_emails_to_subscription_owners: bool - :ivar custom_emails: Custom email addresses for this rule notifications. - :vartype custom_emails: list[str] - :ivar last_updated_time: The last time this rule was updated. - :vartype last_updated_time: str - :ivar rule_definitions: Static definitions of the ProactiveDetection configuration rule (same - values for all components). - :vartype rule_definitions: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions - """ - - _attribute_map = { - "name": {"key": "Name", "type": "str"}, - "enabled": {"key": "Enabled", "type": "bool"}, - "send_emails_to_subscription_owners": {"key": "SendEmailsToSubscriptionOwners", "type": "bool"}, - "custom_emails": {"key": "CustomEmails", "type": "[str]"}, - "last_updated_time": {"key": "LastUpdatedTime", "type": "str"}, - "rule_definitions": { - "key": "RuleDefinitions", - "type": "ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions", - }, - } - - def __init__( - self, - *, - name: Optional[str] = None, - enabled: Optional[bool] = None, - send_emails_to_subscription_owners: Optional[bool] = None, - custom_emails: Optional[list[str]] = None, - last_updated_time: Optional[str] = None, - rule_definitions: Optional[ - "_models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions" - ] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The rule name. - :paramtype name: str - :keyword enabled: A flag that indicates whether this rule is enabled by the user. - :paramtype enabled: bool - :keyword send_emails_to_subscription_owners: A flag that indicated whether notifications on - this rule should be sent to subscription owners. - :paramtype send_emails_to_subscription_owners: bool - :keyword custom_emails: Custom email addresses for this rule notifications. - :paramtype custom_emails: list[str] - :keyword last_updated_time: The last time this rule was updated. - :paramtype last_updated_time: str - :keyword rule_definitions: Static definitions of the ProactiveDetection configuration rule - (same values for all components). - :paramtype rule_definitions: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions - """ - super().__init__(**kwargs) - self.name = name - self.enabled = enabled - self.send_emails_to_subscription_owners = send_emails_to_subscription_owners - self.custom_emails = custom_emails - self.last_updated_time = last_updated_time - self.rule_definitions = rule_definitions - - -class ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions( - _serialization.Model -): # pylint: disable=name-too-long - """Static definitions of the ProactiveDetection configuration rule (same values for all - components). - - :ivar name: The rule name. - :vartype name: str - :ivar display_name: The rule name as it is displayed in UI. - :vartype display_name: str - :ivar description: The rule description. - :vartype description: str - :ivar help_url: URL which displays additional info about the proactive detection rule. - :vartype help_url: str - :ivar is_hidden: A flag indicating whether the rule is hidden (from the UI). - :vartype is_hidden: bool - :ivar is_enabled_by_default: A flag indicating whether the rule is enabled by default. - :vartype is_enabled_by_default: bool - :ivar is_in_preview: A flag indicating whether the rule is in preview. - :vartype is_in_preview: bool - :ivar supports_email_notifications: A flag indicating whether email notifications are supported - for detections for this rule. - :vartype supports_email_notifications: bool - """ - - _attribute_map = { - "name": {"key": "Name", "type": "str"}, - "display_name": {"key": "DisplayName", "type": "str"}, - "description": {"key": "Description", "type": "str"}, - "help_url": {"key": "HelpUrl", "type": "str"}, - "is_hidden": {"key": "IsHidden", "type": "bool"}, - "is_enabled_by_default": {"key": "IsEnabledByDefault", "type": "bool"}, - "is_in_preview": {"key": "IsInPreview", "type": "bool"}, - "supports_email_notifications": {"key": "SupportsEmailNotifications", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - description: Optional[str] = None, - help_url: Optional[str] = None, - is_hidden: Optional[bool] = None, - is_enabled_by_default: Optional[bool] = None, - is_in_preview: Optional[bool] = None, - supports_email_notifications: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The rule name. - :paramtype name: str - :keyword display_name: The rule name as it is displayed in UI. - :paramtype display_name: str - :keyword description: The rule description. - :paramtype description: str - :keyword help_url: URL which displays additional info about the proactive detection rule. - :paramtype help_url: str - :keyword is_hidden: A flag indicating whether the rule is hidden (from the UI). - :paramtype is_hidden: bool - :keyword is_enabled_by_default: A flag indicating whether the rule is enabled by default. - :paramtype is_enabled_by_default: bool - :keyword is_in_preview: A flag indicating whether the rule is in preview. - :paramtype is_in_preview: bool - :keyword supports_email_notifications: A flag indicating whether email notifications are - supported for detections for this rule. - :paramtype supports_email_notifications: bool - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.description = description - self.help_url = help_url - self.is_hidden = is_hidden - self.is_enabled_by_default = is_enabled_by_default - self.is_in_preview = is_in_preview - self.supports_email_notifications = supports_email_notifications - - -class ApplicationInsightsComponentQuotaStatus(_serialization.Model): - """An Application Insights component daily data volume cap status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar app_id: The Application ID for the Application Insights component. - :vartype app_id: str - :ivar should_be_throttled: The daily data volume cap is met, and data ingestion will be - stopped. - :vartype should_be_throttled: bool - :ivar expiration_time: Date and time when the daily data volume cap will be reset, and data - ingestion will resume. - :vartype expiration_time: str - """ - - _validation = { - "app_id": {"readonly": True}, - "should_be_throttled": {"readonly": True}, - "expiration_time": {"readonly": True}, - } - - _attribute_map = { - "app_id": {"key": "AppId", "type": "str"}, - "should_be_throttled": {"key": "ShouldBeThrottled", "type": "bool"}, - "expiration_time": {"key": "ExpirationTime", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.app_id: Optional[str] = None - self.should_be_throttled: Optional[bool] = None - self.expiration_time: Optional[str] = None - - -class ApplicationInsightsComponentWebTestLocation(_serialization.Model): # pylint: disable=name-too-long - """Properties that define a web test location available to an Application Insights Component. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar display_name: The display name of the web test location. - :vartype display_name: str - :ivar tag: Internally defined geographic location tag. - :vartype tag: str - """ - - _validation = { - "display_name": {"readonly": True}, - "tag": {"readonly": True}, - } - - _attribute_map = { - "display_name": {"key": "DisplayName", "type": "str"}, - "tag": {"key": "Tag", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.display_name: Optional[str] = None - self.tag: Optional[str] = None - - -class ApplicationInsightsWebTestLocationsListResult(_serialization.Model): # pylint: disable=name-too-long - """Describes the list of web test locations available to an Application Insights Component. - - All required parameters must be populated in order to send to server. - - :ivar value: List of web test locations. Required. - :vartype value: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentWebTestLocation] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationInsightsComponentWebTestLocation]"}, - } - - def __init__(self, *, value: list["_models.ApplicationInsightsComponentWebTestLocation"], **kwargs: Any) -> None: - """ - :keyword value: List of web test locations. Required. - :paramtype value: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentWebTestLocation] - """ - super().__init__(**kwargs) - self.value = value - - -class ComponentPurgeBody(_serialization.Model): - """Describes the body of a purge request for an App Insights component. - - All required parameters must be populated in order to send to server. - - :ivar table: Table from which to purge data. Required. - :vartype table: str - :ivar filters: The set of columns and filters (queries) to run over them to purge the resulting - data. Required. - :vartype filters: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBodyFilters] - """ - - _validation = { - "table": {"required": True}, - "filters": {"required": True}, - } - - _attribute_map = { - "table": {"key": "table", "type": "str"}, - "filters": {"key": "filters", "type": "[ComponentPurgeBodyFilters]"}, - } - - def __init__(self, *, table: str, filters: list["_models.ComponentPurgeBodyFilters"], **kwargs: Any) -> None: - """ - :keyword table: Table from which to purge data. Required. - :paramtype table: str - :keyword filters: The set of columns and filters (queries) to run over them to purge the - resulting data. Required. - :paramtype filters: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBodyFilters] - """ - super().__init__(**kwargs) - self.table = table - self.filters = filters - - -class ComponentPurgeBodyFilters(_serialization.Model): - """User-defined filters to return data which will be purged from the table. - - :ivar column: The column of the table over which the given query should run. - :vartype column: str - :ivar operator: A query operator to evaluate over the provided column and value(s). Supported - operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would - in a KQL query. - :vartype operator: str - :ivar value: the value for the operator to function over. This can be a number (e.g., > 100), a - string (timestamp >= '2017-09-01') or array of values. - :vartype value: any - :ivar key: When filtering over custom dimensions, this key will be used as the name of the - custom dimension. - :vartype key: str - """ - - _attribute_map = { - "column": {"key": "column", "type": "str"}, - "operator": {"key": "operator", "type": "str"}, - "value": {"key": "value", "type": "object"}, - "key": {"key": "key", "type": "str"}, - } - - def __init__( - self, - *, - column: Optional[str] = None, - operator: Optional[str] = None, - value: Optional[Any] = None, - key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword column: The column of the table over which the given query should run. - :paramtype column: str - :keyword operator: A query operator to evaluate over the provided column and value(s). - Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as - they would in a KQL query. - :paramtype operator: str - :keyword value: the value for the operator to function over. This can be a number (e.g., > - 100), a string (timestamp >= '2017-09-01') or array of values. - :paramtype value: any - :keyword key: When filtering over custom dimensions, this key will be used as the name of the - custom dimension. - :paramtype key: str - """ - super().__init__(**kwargs) - self.column = column - self.operator = operator - self.value = value - self.key = key - - -class ComponentPurgeResponse(_serialization.Model): - """Response containing operationId for a specific purge action. - - All required parameters must be populated in order to send to server. - - :ivar operation_id: Id to use when querying for status for a particular purge operation. - Required. - :vartype operation_id: str - """ - - _validation = { - "operation_id": {"required": True}, - } - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - } - - def __init__(self, *, operation_id: str, **kwargs: Any) -> None: - """ - :keyword operation_id: Id to use when querying for status for a particular purge operation. - Required. - :paramtype operation_id: str - """ - super().__init__(**kwargs) - self.operation_id = operation_id - - -class ComponentPurgeStatusResponse(_serialization.Model): - """Response containing status for a specific purge operation. - - All required parameters must be populated in order to send to server. - - :ivar status: Status of the operation represented by the requested Id. Required. Known values - are: "pending" and "completed". - :vartype status: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.PurgeState - """ - - _validation = { - "status": {"required": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, *, status: Union[str, "_models.PurgeState"], **kwargs: Any) -> None: - """ - :keyword status: Status of the operation represented by the requested Id. Required. Known - values are: "pending" and "completed". - :paramtype status: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.PurgeState - """ - super().__init__(**kwargs) - self.status = status - - -class ErrorFieldContract(_serialization.Model): - """Error Field contract. - - :ivar code: Property level error code. - :vartype code: str - :ivar message: Human-readable representation of property-level error. - :vartype message: str - :ivar target: Property name. - :vartype target: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__( - self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword code: Property level error code. - :paramtype code: str - :keyword message: Human-readable representation of property-level error. - :paramtype message: str - :keyword target: Property name. - :paramtype target: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - - -class ErrorResponse(_serialization.Model): - """Error response indicates Insights service is not able to process the incoming request. The - reason is provided in the error message. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message indicating why the operation failed. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class InnerError(_serialization.Model): - """Inner error. - - :ivar diagnosticcontext: Provides correlation for request. - :vartype diagnosticcontext: str - :ivar time: Request time. - :vartype time: ~datetime.datetime - """ - - _attribute_map = { - "diagnosticcontext": {"key": "diagnosticcontext", "type": "str"}, - "time": {"key": "time", "type": "iso-8601"}, - } - - def __init__( - self, *, diagnosticcontext: Optional[str] = None, time: Optional[datetime.datetime] = None, **kwargs: Any - ) -> None: - """ - :keyword diagnosticcontext: Provides correlation for request. - :paramtype diagnosticcontext: str - :keyword time: Request time. - :paramtype time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.diagnosticcontext = diagnosticcontext - self.time = time - - -class LinkProperties(_serialization.Model): - """Contains a sourceId and workbook resource id to link two resources. - - :ivar source_id: The source Azure resource id. - :vartype source_id: str - :ivar target_id: The workbook Azure resource id. - :vartype target_id: str - :ivar category: The category of workbook. - :vartype category: str - """ - - _attribute_map = { - "source_id": {"key": "sourceId", "type": "str"}, - "target_id": {"key": "targetId", "type": "str"}, - "category": {"key": "category", "type": "str"}, - } - - def __init__( - self, - *, - source_id: Optional[str] = None, - target_id: Optional[str] = None, - category: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_id: The source Azure resource id. - :paramtype source_id: str - :keyword target_id: The workbook Azure resource id. - :paramtype target_id: str - :keyword category: The category of workbook. - :paramtype category: str - """ - super().__init__(**kwargs) - self.source_id = source_id - self.target_id = target_id - self.category = category - - -class MyWorkbookResource(_serialization.Model): - """An azure resource object. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Azure resource Id. - :paramtype id: str - :keyword name: Azure resource name. - :paramtype name: str - :keyword type: Azure resource type. - :paramtype type: str - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.location = location - self.tags = tags - - -class MyWorkbook(MyWorkbookResource): - """An Application Insights private workbook definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind - :ivar display_name: The user-defined name of the private workbook. - :vartype display_name: str - :ivar serialized_data: Configuration of this particular private workbook. Configuration data is - a string containing valid JSON. - :vartype serialized_data: str - :ivar version: This instance's version of the data model. This can change as new features are - added that can be marked private workbook. - :vartype version: str - :ivar time_modified: Date and time in UTC of the last modification that was made to this - private workbook definition. - :vartype time_modified: str - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar tags_properties_tags: A list of 0 or more tags that are associated with this private - workbook definition. - :vartype tags_properties_tags: list[str] - :ivar user_id: Unique user id of the specific user that owns this private workbook. - :vartype user_id: str - :ivar source_id: Optional resourceId for a source resource. - :vartype source_id: str - """ - - _validation = { - "time_modified": {"readonly": True}, - "user_id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "time_modified": {"key": "properties.timeModified", "type": "str"}, - "category": {"key": "properties.category", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - "user_id": {"key": "properties.userId", "type": "str"}, - "source_id": {"key": "properties.sourceId", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, - display_name: Optional[str] = None, - serialized_data: Optional[str] = None, - version: Optional[str] = None, - category: Optional[str] = None, - tags_properties_tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Azure resource Id. - :paramtype id: str - :keyword name: Azure resource name. - :paramtype name: str - :keyword type: Azure resource type. - :paramtype type: str - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :paramtype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind - :keyword display_name: The user-defined name of the private workbook. - :paramtype display_name: str - :keyword serialized_data: Configuration of this particular private workbook. Configuration data - is a string containing valid JSON. - :paramtype serialized_data: str - :keyword version: This instance's version of the data model. This can change as new features - are added that can be marked private workbook. - :paramtype version: str - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword tags_properties_tags: A list of 0 or more tags that are associated with this private - workbook definition. - :paramtype tags_properties_tags: list[str] - :keyword source_id: Optional resourceId for a source resource. - :paramtype source_id: str - """ - super().__init__(id=id, name=name, type=type, location=location, tags=tags, **kwargs) - self.kind = kind - self.display_name = display_name - self.serialized_data = serialized_data - self.version = version - self.time_modified: Optional[str] = None - self.category = category - self.tags_properties_tags = tags_properties_tags - self.user_id: Optional[str] = None - self.source_id = source_id - - -class MyWorkbookError(_serialization.Model): - """Error message body that will indicate why the operation failed. - - :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :vartype code: str - :ivar message: Human-readable representation of the error. - :vartype message: str - :ivar details: The list of invalid fields send in request, in case of validation error. - :vartype details: list[~azure.mgmt.applicationinsights.v2015_05_01.models.ErrorFieldContract] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[ErrorFieldContract]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - details: Optional[list["_models.ErrorFieldContract"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :paramtype code: str - :keyword message: Human-readable representation of the error. - :paramtype message: str - :keyword details: The list of invalid fields send in request, in case of validation error. - :paramtype details: list[~azure.mgmt.applicationinsights.v2015_05_01.models.ErrorFieldContract] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.details = details - - -class MyWorkbooksListResult(_serialization.Model): - """Workbook list result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: An array of private workbooks. - :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[MyWorkbook]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[list["_models.MyWorkbook"]] = None - - -class Operation(_serialization.Model): - """CDN REST API operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.applicationinsights.v2015_05_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: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.applicationinsights.v2015_05_01.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(_serialization.Model): - """The object that represents the operation. - - :ivar provider: Service provider: Microsoft.Cdn. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. - :vartype operation: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Service provider: Microsoft.Cdn. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed: Profile, endpoint, etc. - :paramtype resource: str - :keyword operation: Operation type: Read, write, delete, etc. - :paramtype operation: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - - -class OperationListResult(_serialization.Model): - """Result of the request to list CDN operations. It contains a list of operations and a URL link - to get the next set of results. - - :ivar value: List of CDN operations supported by the CDN resource provider. - :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Operation] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of CDN operations supported by the CDN resource provider. - :paramtype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Operation] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PrivateLinkScopedResource(_serialization.Model): - """The private link scope resource reference. - - :ivar resource_id: The full resource Id of the private link scope resource. - :vartype resource_id: str - :ivar scope_id: The private link scope unique Identifier. - :vartype scope_id: str - """ - - _attribute_map = { - "resource_id": {"key": "ResourceId", "type": "str"}, - "scope_id": {"key": "ScopeId", "type": "str"}, - } - - def __init__(self, *, resource_id: Optional[str] = None, scope_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resource_id: The full resource Id of the private link scope resource. - :paramtype resource_id: str - :keyword scope_id: The private link scope unique Identifier. - :paramtype scope_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.scope_id = scope_id - - -class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on a - WebTest instance. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class WebtestsResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class WebTest(WebtestsResource): - """An Application Insights web test definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: The kind of web test that this web test watches. Choices are ping and multistep. - Known values are: "ping" and "multistep". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestKind - :ivar synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as the - Name field. - :vartype synthetic_monitor_id: str - :ivar web_test_name: User defined name if this WebTest. - :vartype web_test_name: str - :ivar description: Purpose/user defined descriptive test for this WebTest. - :vartype description: str - :ivar enabled: Is the test actively being monitored. - :vartype enabled: bool - :ivar frequency: Interval in seconds between test runs for this WebTest. Default value is 300. - :vartype frequency: int - :ivar timeout: Seconds until this WebTest will timeout and fail. Default value is 30. - :vartype timeout: int - :ivar web_test_kind: The kind of web test this is, valid choices are ping and multistep. Known - values are: "ping" and "multistep". - :vartype web_test_kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestKind - :ivar retry_enabled: Allow for retries should this WebTest fail. - :vartype retry_enabled: bool - :ivar locations: A list of where to physically run the tests from to give global coverage for - accessibility of your application. - :vartype locations: list[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestGeolocation] - :ivar configuration: An XML configuration specification for a WebTest. - :vartype configuration: - ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestPropertiesConfiguration - :ivar provisioning_state: Current state of this component, whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. - :vartype provisioning_state: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "synthetic_monitor_id": {"key": "properties.SyntheticMonitorId", "type": "str"}, - "web_test_name": {"key": "properties.Name", "type": "str"}, - "description": {"key": "properties.Description", "type": "str"}, - "enabled": {"key": "properties.Enabled", "type": "bool"}, - "frequency": {"key": "properties.Frequency", "type": "int"}, - "timeout": {"key": "properties.Timeout", "type": "int"}, - "web_test_kind": {"key": "properties.Kind", "type": "str"}, - "retry_enabled": {"key": "properties.RetryEnabled", "type": "bool"}, - "locations": {"key": "properties.Locations", "type": "[WebTestGeolocation]"}, - "configuration": {"key": "properties.Configuration", "type": "WebTestPropertiesConfiguration"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - kind: Optional[Union[str, "_models.WebTestKind"]] = None, - synthetic_monitor_id: Optional[str] = None, - web_test_name: Optional[str] = None, - description: Optional[str] = None, - enabled: Optional[bool] = None, - frequency: int = 300, - timeout: int = 30, - web_test_kind: Optional[Union[str, "_models.WebTestKind"]] = None, - retry_enabled: Optional[bool] = None, - locations: Optional[list["_models.WebTestGeolocation"]] = None, - configuration: Optional["_models.WebTestPropertiesConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword kind: The kind of web test that this web test watches. Choices are ping and multistep. - Known values are: "ping" and "multistep". - :paramtype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestKind - :keyword synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as - the Name field. - :paramtype synthetic_monitor_id: str - :keyword web_test_name: User defined name if this WebTest. - :paramtype web_test_name: str - :keyword description: Purpose/user defined descriptive test for this WebTest. - :paramtype description: str - :keyword enabled: Is the test actively being monitored. - :paramtype enabled: bool - :keyword frequency: Interval in seconds between test runs for this WebTest. Default value is - 300. - :paramtype frequency: int - :keyword timeout: Seconds until this WebTest will timeout and fail. Default value is 30. - :paramtype timeout: int - :keyword web_test_kind: The kind of web test this is, valid choices are ping and multistep. - Known values are: "ping" and "multistep". - :paramtype web_test_kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestKind - :keyword retry_enabled: Allow for retries should this WebTest fail. - :paramtype retry_enabled: bool - :keyword locations: A list of where to physically run the tests from to give global coverage - for accessibility of your application. - :paramtype locations: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestGeolocation] - :keyword configuration: An XML configuration specification for a WebTest. - :paramtype configuration: - ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTestPropertiesConfiguration - """ - super().__init__(location=location, tags=tags, **kwargs) - self.kind = kind - self.synthetic_monitor_id = synthetic_monitor_id - self.web_test_name = web_test_name - self.description = description - self.enabled = enabled - self.frequency = frequency - self.timeout = timeout - self.web_test_kind = web_test_kind - self.retry_enabled = retry_enabled - self.locations = locations - self.configuration = configuration - self.provisioning_state: Optional[str] = None - - -class WebTestGeolocation(_serialization.Model): - """Geo-physical location to run a web test from. You must specify one or more locations for the - test to run from. - - :ivar location: Location ID for the webtest to run from. - :vartype location: str - """ - - _attribute_map = { - "location": {"key": "Id", "type": "str"}, - } - - def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword location: Location ID for the webtest to run from. - :paramtype location: str - """ - super().__init__(**kwargs) - self.location = location - - -class WebTestListResult(_serialization.Model): - """A list of 0 or more Application Insights web test definitions. - - All required parameters must be populated in order to send to server. - - :ivar value: Set of Application Insights web test definitions. Required. - :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] - :ivar next_link: The link to get the next part of the returned list of web tests, should the - return set be too large for a single request. May be null. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[WebTest]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.WebTest"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Set of Application Insights web test definitions. Required. - :paramtype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] - :keyword next_link: The link to get the next part of the returned list of web tests, should the - return set be too large for a single request. May be null. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class WebTestPropertiesConfiguration(_serialization.Model): - """An XML configuration specification for a WebTest. - - :ivar web_test: The XML specification of a WebTest to run against an application. - :vartype web_test: str - """ - - _attribute_map = { - "web_test": {"key": "WebTest", "type": "str"}, - } - - def __init__(self, *, web_test: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword web_test: The XML specification of a WebTest to run against an application. - :paramtype web_test: str - """ - super().__init__(**kwargs) - self.web_test = web_test - - -class WorkbookResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, 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"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: Optional[str] = None, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class Workbook(WorkbookResource): - """An Application Insights workbook definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind - :ivar name_properties_name: The user-defined name of the workbook. - :vartype name_properties_name: str - :ivar serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :vartype serialized_data: str - :ivar version: This instance's version of the data model. This can change as new features are - added that can be marked workbook. - :vartype version: str - :ivar workbook_id: Internally assigned unique id of the workbook definition. - :vartype workbook_id: str - :ivar shared_type_kind: Enum indicating if this workbook definition is owned by a specific user - or is shared between all users with access to the Application Insights component. Known values - are: "user" and "shared". - :vartype shared_type_kind: str or - ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind - :ivar time_modified: Date and time in UTC of the last modification that was made to this - workbook definition. - :vartype time_modified: str - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :vartype tags_properties_tags: list[str] - :ivar user_id: Unique user id of the specific user that owns this workbook. - :vartype user_id: str - :ivar source_resource_id: Optional resourceId for a source resource. - :vartype source_resource_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "time_modified": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "name_properties_name": {"key": "properties.name", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "workbook_id": {"key": "properties.workbookId", "type": "str"}, - "shared_type_kind": {"key": "properties.kind", "type": "str"}, - "time_modified": {"key": "properties.timeModified", "type": "str"}, - "category": {"key": "properties.category", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - "user_id": {"key": "properties.userId", "type": "str"}, - "source_resource_id": {"key": "properties.sourceResourceId", "type": "str"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, - name_properties_name: Optional[str] = None, - serialized_data: Optional[str] = None, - version: Optional[str] = None, - workbook_id: Optional[str] = None, - shared_type_kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, - category: Optional[str] = None, - tags_properties_tags: Optional[list[str]] = None, - user_id: Optional[str] = None, - source_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :paramtype kind: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind - :keyword name_properties_name: The user-defined name of the workbook. - :paramtype name_properties_name: str - :keyword serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :paramtype serialized_data: str - :keyword version: This instance's version of the data model. This can change as new features - are added that can be marked workbook. - :paramtype version: str - :keyword workbook_id: Internally assigned unique id of the workbook definition. - :paramtype workbook_id: str - :keyword shared_type_kind: Enum indicating if this workbook definition is owned by a specific - user or is shared between all users with access to the Application Insights component. Known - values are: "user" and "shared". - :paramtype shared_type_kind: str or - ~azure.mgmt.applicationinsights.v2015_05_01.models.SharedTypeKind - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :paramtype tags_properties_tags: list[str] - :keyword user_id: Unique user id of the specific user that owns this workbook. - :paramtype user_id: str - :keyword source_resource_id: Optional resourceId for a source resource. - :paramtype source_resource_id: str - """ - super().__init__(location=location, tags=tags, **kwargs) - self.kind = kind - self.name_properties_name = name_properties_name - self.serialized_data = serialized_data - self.version = version - self.workbook_id = workbook_id - self.shared_type_kind = shared_type_kind - self.time_modified: Optional[str] = None - self.category = category - self.tags_properties_tags = tags_properties_tags - self.user_id = user_id - self.source_resource_id = source_resource_id - - -class WorkbookError(_serialization.Model): - """Error message body that will indicate why the operation failed. - - :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :vartype code: str - :ivar message: Human-readable representation of the error. - :vartype message: str - :ivar details: The list of invalid fields send in request, in case of validation error. - :vartype details: list[~azure.mgmt.applicationinsights.v2015_05_01.models.ErrorFieldContract] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[ErrorFieldContract]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - details: Optional[list["_models.ErrorFieldContract"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :paramtype code: str - :keyword message: Human-readable representation of the error. - :paramtype message: str - :keyword details: The list of invalid fields send in request, in case of validation error. - :paramtype details: list[~azure.mgmt.applicationinsights.v2015_05_01.models.ErrorFieldContract] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.details = details - - -class WorkbooksListResult(_serialization.Model): - """Workbook list result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: An array of workbooks. - :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Workbook]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[list["_models.Workbook"]] = None - - -class WorkItemConfiguration(_serialization.Model): - """Work item configuration associated with an application insights resource. - - :ivar connector_id: Connector identifier where work item is created. - :vartype connector_id: str - :ivar config_display_name: Configuration friendly name. - :vartype config_display_name: str - :ivar is_default: Boolean value indicating whether configuration is default. - :vartype is_default: bool - :ivar id: Unique Id for work item. - :vartype id: str - :ivar config_properties: Serialized JSON object for detailed properties. - :vartype config_properties: str - """ - - _attribute_map = { - "connector_id": {"key": "ConnectorId", "type": "str"}, - "config_display_name": {"key": "ConfigDisplayName", "type": "str"}, - "is_default": {"key": "IsDefault", "type": "bool"}, - "id": {"key": "Id", "type": "str"}, - "config_properties": {"key": "ConfigProperties", "type": "str"}, - } - - def __init__( - self, - *, - connector_id: Optional[str] = None, - config_display_name: Optional[str] = None, - is_default: Optional[bool] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - config_properties: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword connector_id: Connector identifier where work item is created. - :paramtype connector_id: str - :keyword config_display_name: Configuration friendly name. - :paramtype config_display_name: str - :keyword is_default: Boolean value indicating whether configuration is default. - :paramtype is_default: bool - :keyword id: Unique Id for work item. - :paramtype id: str - :keyword config_properties: Serialized JSON object for detailed properties. - :paramtype config_properties: str - """ - super().__init__(**kwargs) - self.connector_id = connector_id - self.config_display_name = config_display_name - self.is_default = is_default - self.id = id - self.config_properties = config_properties - - -class WorkItemConfigurationError(_serialization.Model): - """Error associated with trying to get work item configuration or configurations. - - :ivar code: Error detail code and explanation. - :vartype code: str - :ivar message: Error message. - :vartype message: str - :ivar innererror: Inner error. - :vartype innererror: ~azure.mgmt.applicationinsights.v2015_05_01.models.InnerError - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "innererror": {"key": "innererror", "type": "InnerError"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - innererror: Optional["_models.InnerError"] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Error detail code and explanation. - :paramtype code: str - :keyword message: Error message. - :paramtype message: str - :keyword innererror: Inner error. - :paramtype innererror: ~azure.mgmt.applicationinsights.v2015_05_01.models.InnerError - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.innererror = innererror - - -class WorkItemConfigurationsListResult(_serialization.Model): - """Work item configuration list result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: An array of work item configurations. - :vartype value: list[~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[WorkItemConfiguration]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[list["_models.WorkItemConfiguration"]] = None - - -class WorkItemCreateConfiguration(_serialization.Model): - """Work item configuration creation payload. - - :ivar connector_id: Unique connector id. - :vartype connector_id: str - :ivar connector_data_configuration: Serialized JSON object for detailed properties. - :vartype connector_data_configuration: str - :ivar validate_only: Boolean indicating validate only. - :vartype validate_only: bool - :ivar work_item_properties: Custom work item properties. - :vartype work_item_properties: dict[str, str] - """ - - _attribute_map = { - "connector_id": {"key": "ConnectorId", "type": "str"}, - "connector_data_configuration": {"key": "ConnectorDataConfiguration", "type": "str"}, - "validate_only": {"key": "ValidateOnly", "type": "bool"}, - "work_item_properties": {"key": "WorkItemProperties", "type": "{str}"}, - } - - def __init__( - self, - *, - connector_id: Optional[str] = None, - connector_data_configuration: Optional[str] = None, - validate_only: Optional[bool] = None, - work_item_properties: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword connector_id: Unique connector id. - :paramtype connector_id: str - :keyword connector_data_configuration: Serialized JSON object for detailed properties. - :paramtype connector_data_configuration: str - :keyword validate_only: Boolean indicating validate only. - :paramtype validate_only: bool - :keyword work_item_properties: Custom work item properties. - :paramtype work_item_properties: dict[str, str] - """ - super().__init__(**kwargs) - self.connector_id = connector_id - self.connector_data_configuration = connector_data_configuration - self.validate_only = validate_only - self.work_item_properties = work_item_properties diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/__init__.py deleted file mode 100644 index a6e31fd3e1fd..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/__init__.py +++ /dev/null @@ -1,57 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import Operations # type: ignore -from ._annotations_operations import AnnotationsOperations # type: ignore -from ._api_keys_operations import APIKeysOperations # type: ignore -from ._export_configurations_operations import ExportConfigurationsOperations # type: ignore -from ._component_current_billing_features_operations import ComponentCurrentBillingFeaturesOperations # type: ignore -from ._component_quota_status_operations import ComponentQuotaStatusOperations # type: ignore -from ._component_feature_capabilities_operations import ComponentFeatureCapabilitiesOperations # type: ignore -from ._component_available_features_operations import ComponentAvailableFeaturesOperations # type: ignore -from ._proactive_detection_configurations_operations import ProactiveDetectionConfigurationsOperations # type: ignore -from ._components_operations import ComponentsOperations # type: ignore -from ._work_item_configurations_operations import WorkItemConfigurationsOperations # type: ignore -from ._favorites_operations import FavoritesOperations # type: ignore -from ._web_test_locations_operations import WebTestLocationsOperations # type: ignore -from ._web_tests_operations import WebTestsOperations # type: ignore -from ._analytics_items_operations import AnalyticsItemsOperations # type: ignore -from ._workbooks_operations import WorkbooksOperations # type: ignore -from ._my_workbooks_operations import MyWorkbooksOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "AnnotationsOperations", - "APIKeysOperations", - "ExportConfigurationsOperations", - "ComponentCurrentBillingFeaturesOperations", - "ComponentQuotaStatusOperations", - "ComponentFeatureCapabilitiesOperations", - "ComponentAvailableFeaturesOperations", - "ProactiveDetectionConfigurationsOperations", - "ComponentsOperations", - "WorkItemConfigurationsOperations", - "FavoritesOperations", - "WebTestLocationsOperations", - "WebTestsOperations", - "AnalyticsItemsOperations", - "WorkbooksOperations", - "MyWorkbooksOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_analytics_items_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_analytics_items_operations.py deleted file mode 100644 index 7f9a5f717c0a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_analytics_items_operations.py +++ /dev/null @@ -1,636 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - subscription_id: str, - *, - scope: Optional[Union[str, _models.ItemScope]] = None, - type: Union[str, _models.ItemTypeParameter] = "none", - include_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if scope is not None: - _params["scope"] = _SERIALIZER.query("scope", scope, "str") - if type is not None: - _params["type"] = _SERIALIZER.query("type", type, "str") - if include_content is not None: - _params["includeContent"] = _SERIALIZER.query("include_content", include_content, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - subscription_id: str, - *, - id: Optional[str] = None, - name: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if id is not None: - _params["id"] = _SERIALIZER.query("id", id, "str") - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_put_request( - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - subscription_id: str, - *, - override_item: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if override_item is not None: - _params["overrideItem"] = _SERIALIZER.query("override_item", override_item, "bool") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - subscription_id: str, - *, - id: Optional[str] = None, - name: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "scopePath": _SERIALIZER.url("scope_path", scope_path, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if id is not None: - _params["id"] = _SERIALIZER.query("id", id, "str") - if name is not None: - _params["name"] = _SERIALIZER.query("name", name, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -class AnalyticsItemsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`analytics_items` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - scope: Optional[Union[str, _models.ItemScope]] = None, - type: Union[str, _models.ItemTypeParameter] = "none", - include_content: Optional[bool] = None, - **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentAnalyticsItem]: - """Gets a list of Analytics Items defined within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param scope: Enum indicating if this item definition is owned by a specific user or is shared - between all users with access to the Application Insights component. Known values are: "shared" - and "user". Default value is None. - :type scope: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScope - :param type: Enum indicating the type of the Analytics item. Known values are: "none", "query", - "function", "folder", and "recent". Default value is "none". - :type type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemTypeParameter - :param include_content: Flag indicating whether or not to return the content of each applicable - item. If false, only return the item information. Default value is None. - :type include_content: bool - :return: list of ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.ApplicationInsightsComponentAnalyticsItem]] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - scope_path=scope_path, - subscription_id=self._config.subscription_id, - scope=scope, - type=type, - include_content=include_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[ApplicationInsightsComponentAnalyticsItem]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - id: Optional[str] = None, - name: Optional[str] = None, - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAnalyticsItem: - """Gets a specific Analytics Items defined within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param id: The Id of a specific item defined in the Application Insights component. Default - value is None. - :type id: str - :param name: The name of a specific item defined in the Application Insights component. Default - value is None. - :type name: str - :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - scope_path=scope_path, - subscription_id=self._config.subscription_id, - id=id, - name=name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentAnalyticsItem", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def put( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - item_properties: _models.ApplicationInsightsComponentAnalyticsItem, - override_item: Optional[bool] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAnalyticsItem: - """Adds or Updates a specific Analytics Item within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param item_properties: Properties that need to be specified to create a new item and add it to - an Application Insights component. Required. - :type item_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem - :param override_item: Flag indicating whether or not to force save an item. This allows - overriding an item if it already exists. Default value is None. - :type override_item: bool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - item_properties: IO[bytes], - override_item: Optional[bool] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAnalyticsItem: - """Adds or Updates a specific Analytics Item within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param item_properties: Properties that need to be specified to create a new item and add it to - an Application Insights component. Required. - :type item_properties: IO[bytes] - :param override_item: Flag indicating whether or not to force save an item. This allows - overriding an item if it already exists. Default value is None. - :type override_item: bool - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put( - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - item_properties: Union[_models.ApplicationInsightsComponentAnalyticsItem, IO[bytes]], - override_item: Optional[bool] = None, - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAnalyticsItem: - """Adds or Updates a specific Analytics Item within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param item_properties: Properties that need to be specified to create a new item and add it to - an Application Insights component. Is either a ApplicationInsightsComponentAnalyticsItem type - or a IO[bytes] type. Required. - :type item_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem or - IO[bytes] - :param override_item: Flag indicating whether or not to force save an item. This allows - overriding an item if it already exists. Default value is None. - :type override_item: bool - :return: ApplicationInsightsComponentAnalyticsItem or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAnalyticsItem - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentAnalyticsItem] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(item_properties, (IOBase, bytes)): - _content = item_properties - else: - _json = self._serialize.body(item_properties, "ApplicationInsightsComponentAnalyticsItem") - - _request = build_put_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - scope_path=scope_path, - subscription_id=self._config.subscription_id, - override_item=override_item, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentAnalyticsItem", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_name: str, - scope_path: Union[str, _models.ItemScopePath], - id: Optional[str] = None, - name: Optional[str] = None, - **kwargs: Any - ) -> None: - """Deletes a specific Analytics Items defined within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param scope_path: Enum indicating if this item definition is owned by a specific user or is - shared between all users with access to the Application Insights component. Known values are: - "analyticsItems" and "myanalyticsItems". Required. - :type scope_path: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.ItemScopePath - :param id: The Id of a specific item defined in the Application Insights component. Default - value is None. - :type id: str - :param name: The name of a specific item defined in the Application Insights component. Default - value is None. - :type name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - scope_path=scope_path, - subscription_id=self._config.subscription_id, - id=id, - name=name, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_annotations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_annotations_operations.py deleted file mode 100644 index a9576b57445e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_annotations_operations.py +++ /dev/null @@ -1,548 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, resource_name: str, subscription_id: str, *, start: str, end: 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - _params["start"] = _SERIALIZER.query("start", start, "str") - _params["end"] = _SERIALIZER.query("end", end, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, annotation_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "annotationId": _SERIALIZER.url("annotation_id", annotation_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_get_request( - resource_group_name: str, resource_name: str, annotation_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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "annotationId": _SERIALIZER.url("annotation_id", annotation_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class AnnotationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`annotations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, start: str, end: str, **kwargs: Any - ) -> ItemPaged["_models.Annotation"]: - """Gets the list of annotations for a component for given time range. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param start: The start time to query from for annotations, cannot be older than 90 days from - current date. Required. - :type start: str - :param end: The end time to query for annotations. Required. - :type end: str - :return: An iterator like instance of either Annotation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AnnotationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - start=start, - end=end, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AnnotationsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.AnnotationError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - annotation_properties: _models.Annotation, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> List[_models.Annotation]: - """Create an Annotation of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param annotation_properties: Properties that need to be specified to create an annotation of a - Application Insights component. Required. - :type annotation_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - annotation_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> List[_models.Annotation]: - """Create an Annotation of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param annotation_properties: Properties that need to be specified to create an annotation of a - Application Insights component. Required. - :type annotation_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - resource_name: str, - annotation_properties: Union[_models.Annotation, IO[bytes]], - **kwargs: Any - ) -> List[_models.Annotation]: - """Create an Annotation of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param annotation_properties: Properties that need to be specified to create an annotation of a - Application Insights component. Is either a Annotation type or a IO[bytes] type. Required. - :type annotation_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation or - IO[bytes] - :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(annotation_properties, (IOBase, bytes)): - _content = annotation_properties - else: - _json = self._serialize.body(annotation_properties, "Annotation") - - _request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.AnnotationError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[Annotation]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, annotation_id: str, **kwargs: Any - ) -> None: - """Delete an Annotation of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param annotation_id: The unique annotation ID. This is unique within a Application Insights - component. Required. - :type annotation_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - annotation_id=annotation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, annotation_id: str, **kwargs: Any - ) -> List[_models.Annotation]: - """Get the annotation for given id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param annotation_id: The unique annotation ID. This is unique within a Application Insights - component. Required. - :type annotation_id: str - :return: list of Annotation or the result of cls(response) - :rtype: list[~azure.mgmt.applicationinsights.v2015_05_01.models.Annotation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.Annotation]] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - annotation_id=annotation_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.AnnotationError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[Annotation]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_api_keys_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_api_keys_operations.py deleted file mode 100644 index 0c8726da1043..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_api_keys_operations.py +++ /dev/null @@ -1,538 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, key_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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "keyId": _SERIALIZER.url("key_id", key_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, resource_name: str, key_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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "keyId": _SERIALIZER.url("key_id", key_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class APIKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`api_keys` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> ItemPaged["_models.ApplicationInsightsComponentAPIKey"]: - """Gets a list of API keys of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: An iterator like instance of either ApplicationInsightsComponentAPIKey or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentAPIKeyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentAPIKeyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - api_key_properties: _models.APIKeyRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAPIKey: - """Create an API Key of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param api_key_properties: Properties that need to be specified to create an API key of a - Application Insights component. Required. - :type api_key_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.APIKeyRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - api_key_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAPIKey: - """Create an API Key of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param api_key_properties: Properties that need to be specified to create an API key of a - Application Insights component. Required. - :type api_key_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - resource_name: str, - api_key_properties: Union[_models.APIKeyRequest, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentAPIKey: - """Create an API Key of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param api_key_properties: Properties that need to be specified to create an API key of a - Application Insights component. Is either a APIKeyRequest type or a IO[bytes] type. Required. - :type api_key_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.APIKeyRequest or - IO[bytes] - :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(api_key_properties, (IOBase, bytes)): - _content = api_key_properties - else: - _json = self._serialize.body(api_key_properties, "APIKeyRequest") - - _request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentAPIKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( - self, resource_group_name: str, resource_name: str, key_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentAPIKey: - """Delete an API Key of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param key_id: The API Key ID. This is unique within a Application Insights component. - Required. - :type key_id: str - :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - key_id=key_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentAPIKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, key_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentAPIKey: - """Get the API Key for this key id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param key_id: The API Key ID. This is unique within a Application Insights component. - Required. - :type key_id: str - :return: ApplicationInsightsComponentAPIKey or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAPIKey - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentAPIKey] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - key_id=key_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentAPIKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_available_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_available_features_operations.py deleted file mode 100644 index e9dea086e100..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_available_features_operations.py +++ /dev/null @@ -1,149 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/getavailablebillingfeatures", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ComponentAvailableFeaturesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`component_available_features` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentAvailableFeatures: - """Returns all available features of the application insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponentAvailableFeatures or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentAvailableFeatures - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentAvailableFeatures] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentAvailableFeatures", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_current_billing_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_current_billing_features_operations.py deleted file mode 100644 index 6cdbfe1e6562..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_current_billing_features_operations.py +++ /dev/null @@ -1,323 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class ComponentCurrentBillingFeaturesOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`component_current_billing_features` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentBillingFeatures: - """Returns current billing features for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentBillingFeatures", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - billing_features_properties: _models.ApplicationInsightsComponentBillingFeatures, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentBillingFeatures: - """Update current billing features for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param billing_features_properties: Properties that need to be specified to update billing - features for an Application Insights component. Required. - :type billing_features_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - billing_features_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentBillingFeatures: - """Update current billing features for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param billing_features_properties: Properties that need to be specified to update billing - features for an Application Insights component. Required. - :type billing_features_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - billing_features_properties: Union[_models.ApplicationInsightsComponentBillingFeatures, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentBillingFeatures: - """Update current billing features for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param billing_features_properties: Properties that need to be specified to update billing - features for an Application Insights component. Is either a - ApplicationInsightsComponentBillingFeatures type or a IO[bytes] type. Required. - :type billing_features_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - or IO[bytes] - :return: ApplicationInsightsComponentBillingFeatures or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentBillingFeatures - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentBillingFeatures] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(billing_features_properties, (IOBase, bytes)): - _content = billing_features_properties - else: - _json = self._serialize.body(billing_features_properties, "ApplicationInsightsComponentBillingFeatures") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentBillingFeatures", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_feature_capabilities_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_feature_capabilities_operations.py deleted file mode 100644 index 1cbc86549d5f..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_feature_capabilities_operations.py +++ /dev/null @@ -1,149 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/featurecapabilities", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ComponentFeatureCapabilitiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`component_feature_capabilities` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentFeatureCapabilities: - """Returns feature capabilities of the application insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponentFeatureCapabilities or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFeatureCapabilities - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentFeatureCapabilities] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentFeatureCapabilities", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_quota_status_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_quota_status_operations.py deleted file mode 100644 index fb2a3d1b9af9..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_component_quota_status_operations.py +++ /dev/null @@ -1,147 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/quotastatus", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ComponentQuotaStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`component_quota_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentQuotaStatus: - """Returns daily data volume cap (quota) status for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponentQuotaStatus or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentQuotaStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentQuotaStatus] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentQuotaStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_components_operations.py deleted file mode 100644 index 692572a0bfae..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_components_operations.py +++ /dev/null @@ -1,1061 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components") - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_tags_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_purge_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_purge_status_request( - resource_group_name: str, resource_name: str, purge_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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of all Application Insights components within a subscription. - - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of Application Insights components within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Deletes an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ApplicationInsightsComponent: - """Returns an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: _models.ApplicationInsightsComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. - Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent or IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(insight_properties, (IOBase, bytes)): - _content = insight_properties - else: - _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource or - IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(component_tags, (IOBase, bytes)): - _content = component_tags - else: - _json = self._serialize.body(component_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def purge( - self, - resource_group_name: str, - resource_name: str, - body: _models.ComponentPurgeBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def purge( - self, - resource_group_name: str, - resource_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def purge( - self, - resource_group_name: str, - resource_name: str, - body: Union[_models.ComponentPurgeBody, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeBody or IO[bytes] - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "ComponentPurgeBody") - - _request = build_purge_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_purge_status( - self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any - ) -> _models.ComponentPurgeStatusResponse: - """Get status for an ongoing purge operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param purge_id: In a purge status request, this is the Id of the operation the status of which - is returned. Required. - :type purge_id: str - :return: ComponentPurgeStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ComponentPurgeStatusResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) - - _request = build_get_purge_status_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - purge_id=purge_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_export_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_export_configurations_operations.py deleted file mode 100644 index ed56a4fc988d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_export_configurations_operations.py +++ /dev/null @@ -1,716 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, export_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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "exportId": _SERIALIZER.url("export_id", export_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, resource_name: str, export_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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "exportId": _SERIALIZER.url("export_id", export_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, export_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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "exportId": _SERIALIZER.url("export_id", export_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class ExportConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`export_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: - """Gets a list of Continuous Export configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "[ApplicationInsightsComponentExportConfiguration]", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - export_properties: _models.ApplicationInsightsComponentExportRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: - """Create a Continuous Export configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_properties: Properties that need to be specified to create a Continuous Export - configuration of a Application Insights component. Required. - :type export_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - export_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: - """Create a Continuous Export configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_properties: Properties that need to be specified to create a Continuous Export - configuration of a Application Insights component. Required. - :type export_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - resource_name: str, - export_properties: Union[_models.ApplicationInsightsComponentExportRequest, IO[bytes]], - **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentExportConfiguration]: - """Create a Continuous Export configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_properties: Properties that need to be specified to create a Continuous Export - configuration of a Application Insights component. Is either a - ApplicationInsightsComponentExportRequest type or a IO[bytes] type. Required. - :type export_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest or - IO[bytes] - :return: list of ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[List[_models.ApplicationInsightsComponentExportConfiguration]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(export_properties, (IOBase, bytes)): - _content = export_properties - else: - _json = self._serialize.body(export_properties, "ApplicationInsightsComponentExportRequest") - - _request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "[ApplicationInsightsComponentExportConfiguration]", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( - self, resource_group_name: str, resource_name: str, export_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentExportConfiguration: - """Delete a Continuous Export configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_id: The Continuous Export configuration ID. This is unique within a Application - Insights component. Required. - :type export_id: str - :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - export_id=export_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentExportConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, export_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentExportConfiguration: - """Get the Continuous Export configuration for this export id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_id: The Continuous Export configuration ID. This is unique within a Application - Insights component. Required. - :type export_id: str - :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - export_id=export_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentExportConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - export_id: str, - export_properties: _models.ApplicationInsightsComponentExportRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentExportConfiguration: - """Update the Continuous Export configuration for this export id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_id: The Continuous Export configuration ID. This is unique within a Application - Insights component. Required. - :type export_id: str - :param export_properties: Properties that need to be specified to update the Continuous Export - configuration. Required. - :type export_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - export_id: str, - export_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentExportConfiguration: - """Update the Continuous Export configuration for this export id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_id: The Continuous Export configuration ID. This is unique within a Application - Insights component. Required. - :type export_id: str - :param export_properties: Properties that need to be specified to update the Continuous Export - configuration. Required. - :type export_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - export_id: str, - export_properties: Union[_models.ApplicationInsightsComponentExportRequest, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentExportConfiguration: - """Update the Continuous Export configuration for this export id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param export_id: The Continuous Export configuration ID. This is unique within a Application - Insights component. Required. - :type export_id: str - :param export_properties: Properties that need to be specified to update the Continuous Export - configuration. Is either a ApplicationInsightsComponentExportRequest type or a IO[bytes] type. - Required. - :type export_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportRequest or - IO[bytes] - :return: ApplicationInsightsComponentExportConfiguration or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentExportConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentExportConfiguration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(export_properties, (IOBase, bytes)): - _content = export_properties - else: - _json = self._serialize.body(export_properties, "ApplicationInsightsComponentExportRequest") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - export_id=export_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentExportConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_favorites_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_favorites_operations.py deleted file mode 100644 index c02ae6341e31..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_favorites_operations.py +++ /dev/null @@ -1,741 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - favorite_type: Optional[Union[str, _models.FavoriteType]] = None, - source_type: Optional[Union[str, _models.FavoriteSourceType]] = None, - can_fetch_content: Optional[bool] = None, - tags: Optional[List[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-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if favorite_type is not None: - _params["favoriteType"] = _SERIALIZER.query("favorite_type", favorite_type, "str") - if source_type is not None: - _params["sourceType"] = _SERIALIZER.query("source_type", source_type, "str") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, resource_name: str, favorite_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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_add_request( - resource_group_name: str, resource_name: str, favorite_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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, favorite_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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, favorite_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "favoriteId": _SERIALIZER.url("favorite_id", favorite_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -class FavoritesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`favorites` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - resource_group_name: str, - resource_name: str, - favorite_type: Optional[Union[str, _models.FavoriteType]] = None, - source_type: Optional[Union[str, _models.FavoriteSourceType]] = None, - can_fetch_content: Optional[bool] = None, - tags: Optional[List[str]] = None, - **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentFavorite]: - """Gets a list of favorites defined within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_type: The type of favorite. Value can be either shared or user. Known values - are: "shared" and "user". Default value is None. - :type favorite_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteType - :param source_type: Source type of favorite to return. When left out, the source type defaults - to 'other' (not present in this enum). Known values are: "retention", "notebook", "sessions", - "events", "userflows", "funnel", "impact", and "segmentation". Default value is None. - :type source_type: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.FavoriteSourceType - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable favorite. If false, only return summary content for favorites. Default value is - None. - :type can_fetch_content: bool - :param tags: Tags that must be present on each favorite returned. Default value is None. - :type tags: list[str] - :return: list of ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.ApplicationInsightsComponentFavorite]] = kwargs.pop("cls", None) - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - favorite_type=favorite_type, - source_type=source_type, - can_fetch_content=can_fetch_content, - tags=tags, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[ApplicationInsightsComponentFavorite]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, favorite_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Get a single favorite by its FavoriteId, defined within an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - favorite_id=favorite_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentFavorite", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def add( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: _models.ApplicationInsightsComponentFavorite, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Adds a new favorites to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to create a new favorite and - add it to an Application Insights component. Required. - :type favorite_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def add( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Adds a new favorites to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to create a new favorite and - add it to an Application Insights component. Required. - :type favorite_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def add( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: Union[_models.ApplicationInsightsComponentFavorite, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Adds a new favorites to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to create a new favorite and - add it to an Application Insights component. Is either a ApplicationInsightsComponentFavorite - type or a IO[bytes] type. Required. - :type favorite_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite or - IO[bytes] - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(favorite_properties, (IOBase, bytes)): - _content = favorite_properties - else: - _json = self._serialize.body(favorite_properties, "ApplicationInsightsComponentFavorite") - - _request = build_add_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - favorite_id=favorite_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentFavorite", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: _models.ApplicationInsightsComponentFavorite, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Updates a favorite that has already been added to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to update the existing - favorite. Required. - :type favorite_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Updates a favorite that has already been added to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to update the existing - favorite. Required. - :type favorite_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - favorite_id: str, - favorite_properties: Union[_models.ApplicationInsightsComponentFavorite, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentFavorite: - """Updates a favorite that has already been added to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :param favorite_properties: Properties that need to be specified to update the existing - favorite. Is either a ApplicationInsightsComponentFavorite type or a IO[bytes] type. Required. - :type favorite_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite or - IO[bytes] - :return: ApplicationInsightsComponentFavorite or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentFavorite - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentFavorite] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(favorite_properties, (IOBase, bytes)): - _content = favorite_properties - else: - _json = self._serialize.body(favorite_properties, "ApplicationInsightsComponentFavorite") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - favorite_id=favorite_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentFavorite", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, favorite_id: str, **kwargs: Any - ) -> None: - """Remove a favorite that is associated to an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param favorite_id: The Id of a specific favorite defined in the Application Insights - component. Required. - :type favorite_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - favorite_id=favorite_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_my_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_my_workbooks_operations.py deleted file mode 100644 index 28bd6774b4ae..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_my_workbooks_operations.py +++ /dev/null @@ -1,865 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks", - ) - 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["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - _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_subscription_request( - subscription_id: str, - *, - category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks") - 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["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MyWorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`my_workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.MyWorkbook"]: - """Get all private workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either MyWorkbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MyWorkbooksListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription( - self, - category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.MyWorkbook"]: - """Get all private workbooks defined within a specified subscription and category. - - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either MyWorkbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MyWorkbooksListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.MyWorkbook: - """Get a single private workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Delete a private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.MyWorkbook, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.MyWorkbook, IO[bytes]], - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook or - IO[bytes] - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "MyWorkbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.MyWorkbook, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.MyWorkbook, IO[bytes]], - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook or - IO[bytes] - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "MyWorkbook") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_operations.py deleted file mode 100644 index 0bfbb5beb9d2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_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-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/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.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: - """Lists all of the available insights REST API operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_proactive_detection_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_proactive_detection_configurations_operations.py deleted file mode 100644 index d03a151d514d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_proactive_detection_configurations_operations.py +++ /dev/null @@ -1,452 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, resource_name: str, configuration_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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, configuration_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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`proactive_detection_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]: - """Gets a list of ProactiveDetection configurations of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: list of ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( - "cls", None - ) - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "[ApplicationInsightsComponentProactiveDetectionConfiguration]", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, configuration_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Get the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - configuration_id=configuration_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: _models.ApplicationInsightsComponentProactiveDetectionConfiguration, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Required. - :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Required. - :type proactive_detection_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: Union[ - _models.ApplicationInsightsComponentProactiveDetectionConfiguration, IO[bytes] - ], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Is either a - ApplicationInsightsComponentProactiveDetectionConfiguration type or a IO[bytes] type. Required. - :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - or IO[bytes] - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(proactive_detection_properties, (IOBase, bytes)): - _content = proactive_detection_properties - else: - _json = self._serialize.body( - proactive_detection_properties, "ApplicationInsightsComponentProactiveDetectionConfiguration" - ) - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - configuration_id=configuration_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_test_locations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_test_locations_operations.py deleted file mode 100644 index 1a7d803aefcb..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_test_locations_operations.py +++ /dev/null @@ -1,178 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/syntheticmonitorlocations", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class WebTestLocationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`web_test_locations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> ItemPaged["_models.ApplicationInsightsComponentWebTestLocation"]: - """Gets a list of web test locations available to this Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: An iterator like instance of either ApplicationInsightsComponentWebTestLocation or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.ApplicationInsightsComponentWebTestLocation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsWebTestLocationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsWebTestLocationsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_tests_operations.py deleted file mode 100644 index 4161ed4606c7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_web_tests_operations.py +++ /dev/null @@ -1,889 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, web_test_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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "webTestName": _SERIALIZER.url("web_test_name", web_test_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_create_or_update_request( - resource_group_name: str, web_test_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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_tags_request( - resource_group_name: str, web_test_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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, web_test_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - 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 - ), - "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests") - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_component_request( - component_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{componentName}/webtests", - ) - path_format_arguments = { - "componentName": _SERIALIZER.url("component_name", component_name, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class WebTestsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`web_tests` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined within a specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: - """Get a specific Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: _models.WebTest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: Union[_models.WebTest, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. - Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest or - IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_definition, (IOBase, bytes)): - _content = web_test_definition - else: - _json = self._serialize.body(web_test_definition, "WebTest") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Required. - :type web_test_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2015_05_01.models.TagsResource or - IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_tags, (IOBase, bytes)): - _content = web_test_tags - else: - _json = self._serialize.body(web_test_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, web_test_name: str, **kwargs: Any - ) -> None: - """Deletes an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights webtest resource. Required. - :type web_test_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.WebTest"]: - """Get all Application Insights web test alerts definitions within a subscription. - - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_component( - self, component_name: str, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined for the specified component. - - :param component_name: The name of the Application Insights component resource. Required. - :type component_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_component_request( - component_name=component_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_work_item_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_work_item_configurations_operations.py deleted file mode 100644 index 59196bb102c7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_work_item_configurations_operations.py +++ /dev/null @@ -1,807 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_default_request( - resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/DefaultWorkItemConfig", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, work_item_config_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "workItemConfigId": _SERIALIZER.url("work_item_config_id", work_item_config_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_get_item_request( - resource_group_name: str, resource_name: str, work_item_config_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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "workItemConfigId": _SERIALIZER.url("work_item_config_id", work_item_config_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_item_request( - resource_group_name: str, resource_name: str, work_item_config_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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "workItemConfigId": _SERIALIZER.url("work_item_config_id", work_item_config_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class WorkItemConfigurationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`work_item_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> ItemPaged["_models.WorkItemConfiguration"]: - """Gets the list work item configurations that exist for the application. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: An iterator like instance of either WorkItemConfiguration or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkItemConfigurationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkItemConfigurationsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.WorkItemConfigurationError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - work_item_configuration_properties: _models.WorkItemCreateConfiguration, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Create a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_configuration_properties: Properties that need to be specified to create a - work item configuration of a Application Insights component. Required. - :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - resource_name: str, - work_item_configuration_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Create a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_configuration_properties: Properties that need to be specified to create a - work item configuration of a Application Insights component. Required. - :type work_item_configuration_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - resource_name: str, - work_item_configuration_properties: Union[_models.WorkItemCreateConfiguration, IO[bytes]], - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Create a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_configuration_properties: Properties that need to be specified to create a - work item configuration of a Application Insights component. Is either a - WorkItemCreateConfiguration type or a IO[bytes] type. Required. - :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration or IO[bytes] - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(work_item_configuration_properties, (IOBase, bytes)): - _content = work_item_configuration_properties - else: - _json = self._serialize.body(work_item_configuration_properties, "WorkItemCreateConfiguration") - - _request = build_create_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkItemConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_default(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.WorkItemConfiguration: - """Gets default work item configurations that exist for the application. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) - - _request = build_get_default_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkItemConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, work_item_config_id: str, **kwargs: Any - ) -> None: - """Delete a work item configuration of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_config_id: The unique work item configuration Id. This can be either friendly - name of connector as defined in connector configuration. Required. - :type work_item_config_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - work_item_config_id=work_item_config_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_item( - self, resource_group_name: str, resource_name: str, work_item_config_id: str, **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Gets specified work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_config_id: The unique work item configuration Id. This can be either friendly - name of connector as defined in connector configuration. Required. - :type work_item_config_id: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) - - _request = build_get_item_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - work_item_config_id=work_item_config_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkItemConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_item( - self, - resource_group_name: str, - resource_name: str, - work_item_config_id: str, - work_item_configuration_properties: _models.WorkItemCreateConfiguration, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Update a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_config_id: The unique work item configuration Id. This can be either friendly - name of connector as defined in connector configuration. Required. - :type work_item_config_id: str - :param work_item_configuration_properties: Properties that need to be specified to update a - work item configuration for this Application Insights component. Required. - :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_item( - self, - resource_group_name: str, - resource_name: str, - work_item_config_id: str, - work_item_configuration_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Update a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_config_id: The unique work item configuration Id. This can be either friendly - name of connector as defined in connector configuration. Required. - :type work_item_config_id: str - :param work_item_configuration_properties: Properties that need to be specified to update a - work item configuration for this Application Insights component. Required. - :type work_item_configuration_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_item( - self, - resource_group_name: str, - resource_name: str, - work_item_config_id: str, - work_item_configuration_properties: Union[_models.WorkItemCreateConfiguration, IO[bytes]], - **kwargs: Any - ) -> _models.WorkItemConfiguration: - """Update a work item configuration for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param work_item_config_id: The unique work item configuration Id. This can be either friendly - name of connector as defined in connector configuration. Required. - :type work_item_config_id: str - :param work_item_configuration_properties: Properties that need to be specified to update a - work item configuration for this Application Insights component. Is either a - WorkItemCreateConfiguration type or a IO[bytes] type. Required. - :type work_item_configuration_properties: - ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemCreateConfiguration or IO[bytes] - :return: WorkItemConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.WorkItemConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkItemConfiguration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(work_item_configuration_properties, (IOBase, bytes)): - _content = work_item_configuration_properties - else: - _json = self._serialize.body(work_item_configuration_properties, "WorkItemCreateConfiguration") - - _request = build_update_item_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - work_item_config_id=work_item_config_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkItemConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_workbooks_operations.py deleted file mode 100644 index 95d6a5947b54..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2015_05_01/operations/_workbooks_operations.py +++ /dev/null @@ -1,732 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks", - ) - 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["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2015-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, 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", "2015-05-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class WorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2015_05_01.ApplicationInsightsManagementClient`'s - :attr:`workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2015_05_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Workbook: - """Get a single workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Delete a workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.Workbook, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.Workbook, IO[bytes]], - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. Is - either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook or - IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "Workbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.Workbook, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.Workbook, IO[bytes]], - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. Is - either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook or - IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2015_05_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "Workbook") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_application_insights_management_client.py deleted file mode 100644 index bc889d4070c7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_application_insights_management_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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import ( - ComponentCurrentPricingPlanOperations, - EASubscriptionListMigrationDateOperations, - EASubscriptionMigrateToNewPricingModelOperations, - EASubscriptionRollbackToLegacyPricingModelOperations, -) - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar ea_subscription_migrate_to_new_pricing_model: - EASubscriptionMigrateToNewPricingModelOperations operations - :vartype ea_subscription_migrate_to_new_pricing_model: - azure.mgmt.applicationinsights.v2017_10_01.operations.EASubscriptionMigrateToNewPricingModelOperations - :ivar ea_subscription_rollback_to_legacy_pricing_model: - EASubscriptionRollbackToLegacyPricingModelOperations operations - :vartype ea_subscription_rollback_to_legacy_pricing_model: - azure.mgmt.applicationinsights.v2017_10_01.operations.EASubscriptionRollbackToLegacyPricingModelOperations - :ivar ea_subscription_list_migration_date: EASubscriptionListMigrationDateOperations operations - :vartype ea_subscription_list_migration_date: - azure.mgmt.applicationinsights.v2017_10_01.operations.EASubscriptionListMigrationDateOperations - :ivar component_current_pricing_plan: ComponentCurrentPricingPlanOperations operations - :vartype component_current_pricing_plan: - azure.mgmt.applicationinsights.v2017_10_01.operations.ComponentCurrentPricingPlanOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2017-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.ea_subscription_migrate_to_new_pricing_model = EASubscriptionMigrateToNewPricingModelOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.ea_subscription_rollback_to_legacy_pricing_model = EASubscriptionRollbackToLegacyPricingModelOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.ea_subscription_list_migration_date = EASubscriptionListMigrationDateOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.component_current_pricing_plan = ComponentCurrentPricingPlanOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_configuration.py deleted file mode 100644 index 0b65cb4dae46..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2017-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, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2017-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_application_insights_management_client.py deleted file mode 100644 index feec4d8b20da..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_application_insights_management_client.py +++ /dev/null @@ -1,159 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import ( - ComponentCurrentPricingPlanOperations, - EASubscriptionListMigrationDateOperations, - EASubscriptionMigrateToNewPricingModelOperations, - EASubscriptionRollbackToLegacyPricingModelOperations, -) - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar ea_subscription_migrate_to_new_pricing_model: - EASubscriptionMigrateToNewPricingModelOperations operations - :vartype ea_subscription_migrate_to_new_pricing_model: - azure.mgmt.applicationinsights.v2017_10_01.aio.operations.EASubscriptionMigrateToNewPricingModelOperations - :ivar ea_subscription_rollback_to_legacy_pricing_model: - EASubscriptionRollbackToLegacyPricingModelOperations operations - :vartype ea_subscription_rollback_to_legacy_pricing_model: - azure.mgmt.applicationinsights.v2017_10_01.aio.operations.EASubscriptionRollbackToLegacyPricingModelOperations - :ivar ea_subscription_list_migration_date: EASubscriptionListMigrationDateOperations operations - :vartype ea_subscription_list_migration_date: - azure.mgmt.applicationinsights.v2017_10_01.aio.operations.EASubscriptionListMigrationDateOperations - :ivar component_current_pricing_plan: ComponentCurrentPricingPlanOperations operations - :vartype component_current_pricing_plan: - azure.mgmt.applicationinsights.v2017_10_01.aio.operations.ComponentCurrentPricingPlanOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2017-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.ea_subscription_migrate_to_new_pricing_model = EASubscriptionMigrateToNewPricingModelOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.ea_subscription_rollback_to_legacy_pricing_model = EASubscriptionRollbackToLegacyPricingModelOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.ea_subscription_list_migration_date = EASubscriptionListMigrationDateOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.component_current_pricing_plan = ComponentCurrentPricingPlanOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_configuration.py deleted file mode 100644 index efc78aabc021..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2017-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, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2017-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/__init__.py deleted file mode 100644 index e591e53f1a74..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._ea_subscription_migrate_to_new_pricing_model_operations import EASubscriptionMigrateToNewPricingModelOperations # type: ignore -from ._ea_subscription_rollback_to_legacy_pricing_model_operations import EASubscriptionRollbackToLegacyPricingModelOperations # type: ignore -from ._ea_subscription_list_migration_date_operations import EASubscriptionListMigrationDateOperations # type: ignore -from ._component_current_pricing_plan_operations import ComponentCurrentPricingPlanOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EASubscriptionMigrateToNewPricingModelOperations", - "EASubscriptionRollbackToLegacyPricingModelOperations", - "EASubscriptionListMigrationDateOperations", - "ComponentCurrentPricingPlanOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_component_current_pricing_plan_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_component_current_pricing_plan_operations.py deleted file mode 100644 index 0dc35cc3da64..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_component_current_pricing_plan_operations.py +++ /dev/null @@ -1,395 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._component_current_pricing_plan_operations import ( - build_create_and_update_request, - build_get_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class ComponentCurrentPricingPlanOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2017_10_01.aio.ApplicationInsightsManagementClient`'s - :attr:`component_current_pricing_plan` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Returns the current pricing plan setting for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_and_update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: _models.ApplicationInsightsComponentPricingPlan, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Replace current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Required. - :type pricing_plan_properties: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_and_update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Replace current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Required. - :type pricing_plan_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_and_update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: Union[_models.ApplicationInsightsComponentPricingPlan, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Replace current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Is either a ApplicationInsightsComponentPricingPlan - type or a IO[bytes] type. Required. - :type pricing_plan_properties: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan or - IO[bytes] - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(pricing_plan_properties, (IOBase, bytes)): - _content = pricing_plan_properties - else: - _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") - - _request = build_create_and_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: _models.ApplicationInsightsComponentPricingPlan, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Update current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Required. - :type pricing_plan_properties: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Update current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Required. - :type pricing_plan_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: Union[_models.ApplicationInsightsComponentPricingPlan, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Update current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Is either a ApplicationInsightsComponentPricingPlan - type or a IO[bytes] type. Required. - :type pricing_plan_properties: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan or - IO[bytes] - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(pricing_plan_properties, (IOBase, bytes)): - _content = pricing_plan_properties - else: - _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_list_migration_date_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_list_migration_date_operations.py deleted file mode 100644 index ba8933edab20..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_list_migration_date_operations.py +++ /dev/null @@ -1,102 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._ea_subscription_list_migration_date_operations import build_post_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class EASubscriptionListMigrationDateOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2017_10_01.aio.ApplicationInsightsManagementClient`'s - :attr:`ea_subscription_list_migration_date` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def post(self, **kwargs: Any) -> _models.EASubscriptionMigrationDate: - """list date to migrate to new pricing model. - - :return: EASubscriptionMigrationDate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2017_10_01.models.EASubscriptionMigrationDate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.EASubscriptionMigrationDate] = kwargs.pop("cls", None) - - _request = build_post_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EASubscriptionMigrationDate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py deleted file mode 100644 index 7af58ce20ee5..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._ea_subscription_migrate_to_new_pricing_model_operations import build_post_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class EASubscriptionMigrateToNewPricingModelOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2017_10_01.aio.ApplicationInsightsManagementClient`'s - :attr:`ea_subscription_migrate_to_new_pricing_model` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def post(self, **kwargs: Any) -> None: - """Enterprise Agreement Customer opted to use new pricing model. - - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_post_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py deleted file mode 100644 index 5bd246ff6c75..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._ea_subscription_rollback_to_legacy_pricing_model_operations import build_post_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class EASubscriptionRollbackToLegacyPricingModelOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2017_10_01.aio.ApplicationInsightsManagementClient`'s - :attr:`ea_subscription_rollback_to_legacy_pricing_model` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def post(self, **kwargs: Any) -> None: - """Enterprise Agreement Customer roll back to use legacy pricing model. - - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_post_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/__init__.py deleted file mode 100644 index 1cea28d5c33a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/__init__.py +++ /dev/null @@ -1,33 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ApplicationInsightsComponentPricingPlan, - CloudErrorBody, - EASubscriptionMigrationDate, - Resource, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsComponentPricingPlan", - "CloudErrorBody", - "EASubscriptionMigrationDate", - "Resource", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_models_py3.py deleted file mode 100644 index 82beb21d7a79..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_models_py3.py +++ /dev/null @@ -1,219 +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. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Optional, TYPE_CHECKING - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class Resource(_serialization.Model): - """An Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :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: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - - -class ApplicationInsightsComponentPricingPlan(Resource): - """An Application Insights component pricing plan. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar plan_type: Pricing Plan Type Name. - :vartype plan_type: str - :ivar cap: Daily data volume cap in GB. - :vartype cap: float - :ivar reset_hour: Daily data volume cap UTC reset hour. - :vartype reset_hour: int - :ivar warning_threshold: Reserved, not used for now. - :vartype warning_threshold: int - :ivar stop_send_notification_when_hit_threshold: Reserved, not used for now. - :vartype stop_send_notification_when_hit_threshold: bool - :ivar stop_send_notification_when_hit_cap: Do not send a notification email when the daily data - volume cap is met. - :vartype stop_send_notification_when_hit_cap: bool - :ivar max_history_cap: Maximum daily data volume cap that the user can set for this component. - :vartype max_history_cap: float - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "reset_hour": {"readonly": True}, - "max_history_cap": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "plan_type": {"key": "properties.planType", "type": "str"}, - "cap": {"key": "properties.cap", "type": "float"}, - "reset_hour": {"key": "properties.resetHour", "type": "int"}, - "warning_threshold": {"key": "properties.warningThreshold", "type": "int"}, - "stop_send_notification_when_hit_threshold": { - "key": "properties.stopSendNotificationWhenHitThreshold", - "type": "bool", - }, - "stop_send_notification_when_hit_cap": {"key": "properties.stopSendNotificationWhenHitCap", "type": "bool"}, - "max_history_cap": {"key": "properties.maxHistoryCap", "type": "float"}, - } - - def __init__( - self, - *, - plan_type: Optional[str] = None, - cap: Optional[float] = None, - warning_threshold: Optional[int] = None, - stop_send_notification_when_hit_threshold: Optional[bool] = None, - stop_send_notification_when_hit_cap: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword plan_type: Pricing Plan Type Name. - :paramtype plan_type: str - :keyword cap: Daily data volume cap in GB. - :paramtype cap: float - :keyword warning_threshold: Reserved, not used for now. - :paramtype warning_threshold: int - :keyword stop_send_notification_when_hit_threshold: Reserved, not used for now. - :paramtype stop_send_notification_when_hit_threshold: bool - :keyword stop_send_notification_when_hit_cap: Do not send a notification email when the daily - data volume cap is met. - :paramtype stop_send_notification_when_hit_cap: bool - """ - super().__init__(**kwargs) - self.plan_type = plan_type - self.cap = cap - self.reset_hour: Optional[int] = None - self.warning_threshold = warning_threshold - self.stop_send_notification_when_hit_threshold = stop_send_notification_when_hit_threshold - self.stop_send_notification_when_hit_cap = stop_send_notification_when_hit_cap - self.max_history_cap: Optional[float] = None - - -class CloudErrorBody(_serialization.Model): - """An error response from the Batch service. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.applicationinsights.v2017_10_01.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[list["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.applicationinsights.v2017_10_01.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class EASubscriptionMigrationDate(_serialization.Model): - """Subscription migrate date information properties. - - :ivar is_grand_fatherable_subscription: Is subscription in the grand fatherable subscription - list. - :vartype is_grand_fatherable_subscription: bool - :ivar opted_in_date: Time to start using new pricing model. - :vartype opted_in_date: ~datetime.datetime - """ - - _attribute_map = { - "is_grand_fatherable_subscription": {"key": "isGrandFatherableSubscription", "type": "bool"}, - "opted_in_date": {"key": "optedInDate", "type": "iso-8601"}, - } - - def __init__( - self, - *, - is_grand_fatherable_subscription: Optional[bool] = None, - opted_in_date: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_grand_fatherable_subscription: Is subscription in the grand fatherable subscription - list. - :paramtype is_grand_fatherable_subscription: bool - :keyword opted_in_date: Time to start using new pricing model. - :paramtype opted_in_date: ~datetime.datetime - """ - super().__init__(**kwargs) - self.is_grand_fatherable_subscription = is_grand_fatherable_subscription - self.opted_in_date = opted_in_date diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/__init__.py deleted file mode 100644 index e591e53f1a74..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/__init__.py +++ /dev/null @@ -1,32 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._ea_subscription_migrate_to_new_pricing_model_operations import EASubscriptionMigrateToNewPricingModelOperations # type: ignore -from ._ea_subscription_rollback_to_legacy_pricing_model_operations import EASubscriptionRollbackToLegacyPricingModelOperations # type: ignore -from ._ea_subscription_list_migration_date_operations import EASubscriptionListMigrationDateOperations # type: ignore -from ._component_current_pricing_plan_operations import ComponentCurrentPricingPlanOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "EASubscriptionMigrateToNewPricingModelOperations", - "EASubscriptionRollbackToLegacyPricingModelOperations", - "EASubscriptionListMigrationDateOperations", - "ComponentCurrentPricingPlanOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_component_current_pricing_plan_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_component_current_pricing_plan_operations.py deleted file mode 100644 index ba25ce8cb3a2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_component_current_pricing_plan_operations.py +++ /dev/null @@ -1,497 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, 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", "2017-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/pricingPlans/current", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_and_update_request( - resource_group_name: str, 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", "2017-10-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/pricingPlans/current", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, 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", "2017-10-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/pricingPlans/current", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class ComponentCurrentPricingPlanOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2017_10_01.ApplicationInsightsManagementClient`'s - :attr:`component_current_pricing_plan` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Returns the current pricing plan setting for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_and_update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: _models.ApplicationInsightsComponentPricingPlan, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Replace current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Required. - :type pricing_plan_properties: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_and_update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Replace current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Required. - :type pricing_plan_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_and_update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: Union[_models.ApplicationInsightsComponentPricingPlan, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Replace current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Is either a ApplicationInsightsComponentPricingPlan - type or a IO[bytes] type. Required. - :type pricing_plan_properties: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan or - IO[bytes] - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(pricing_plan_properties, (IOBase, bytes)): - _content = pricing_plan_properties - else: - _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") - - _request = build_create_and_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: _models.ApplicationInsightsComponentPricingPlan, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Update current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Required. - :type pricing_plan_properties: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Update current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Required. - :type pricing_plan_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - pricing_plan_properties: Union[_models.ApplicationInsightsComponentPricingPlan, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentPricingPlan: - """Update current pricing plan for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param pricing_plan_properties: Properties that need to be specified to update current pricing - plan for an Application Insights component. Is either a ApplicationInsightsComponentPricingPlan - type or a IO[bytes] type. Required. - :type pricing_plan_properties: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan or - IO[bytes] - :return: ApplicationInsightsComponentPricingPlan or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2017_10_01.models.ApplicationInsightsComponentPricingPlan - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentPricingPlan] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(pricing_plan_properties, (IOBase, bytes)): - _content = pricing_plan_properties - else: - _json = self._serialize.body(pricing_plan_properties, "ApplicationInsightsComponentPricingPlan") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponentPricingPlan", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_list_migration_date_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_list_migration_date_operations.py deleted file mode 100644 index 67bf3fabd5e1..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_list_migration_date_operations.py +++ /dev/null @@ -1,128 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_post_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/listMigrationdate") - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class EASubscriptionListMigrationDateOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2017_10_01.ApplicationInsightsManagementClient`'s - :attr:`ea_subscription_list_migration_date` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def post(self, **kwargs: Any) -> _models.EASubscriptionMigrationDate: - """list date to migrate to new pricing model. - - :return: EASubscriptionMigrationDate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2017_10_01.models.EASubscriptionMigrationDate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.EASubscriptionMigrationDate] = kwargs.pop("cls", None) - - _request = build_post_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EASubscriptionMigrationDate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py deleted file mode 100644 index 34b39123f17b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_migrate_to_new_pricing_model_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_post_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/migrateToNewPricingModel" - ) - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class EASubscriptionMigrateToNewPricingModelOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2017_10_01.ApplicationInsightsManagementClient`'s - :attr:`ea_subscription_migrate_to_new_pricing_model` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Enterprise Agreement Customer opted to use new pricing model. - - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_post_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py deleted file mode 100644 index 90a2147d5ed4..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_ea_subscription_rollback_to_legacy_pricing_model_operations.py +++ /dev/null @@ -1,126 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_post_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2017-10-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/microsoft.insights/rollbackToLegacyPricingModel" - ) - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class EASubscriptionRollbackToLegacyPricingModelOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2017_10_01.ApplicationInsightsManagementClient`'s - :attr:`ea_subscription_rollback_to_legacy_pricing_model` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def post(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - """Enterprise Agreement Customer roll back to use legacy pricing model. - - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_post_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2017_10_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_application_insights_management_client.py deleted file mode 100644 index 039787063899..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_application_insights_management_client.py +++ /dev/null @@ -1,141 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import ComponentsOperations, Operations, ProactiveDetectionConfigurationsOperations, WebTestsOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar proactive_detection_configurations: ProactiveDetectionConfigurationsOperations operations - :vartype proactive_detection_configurations: - azure.mgmt.applicationinsights.v2018_05_01_preview.operations.ProactiveDetectionConfigurationsOperations - :ivar components: ComponentsOperations operations - :vartype components: - azure.mgmt.applicationinsights.v2018_05_01_preview.operations.ComponentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.applicationinsights.v2018_05_01_preview.operations.Operations - :ivar web_tests: WebTestsOperations operations - :vartype web_tests: - azure.mgmt.applicationinsights.v2018_05_01_preview.operations.WebTestsOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2018-05-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_configuration.py deleted file mode 100644 index 70941a117d43..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2018-05-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, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2018-05-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_application_insights_management_client.py deleted file mode 100644 index 025f8ab85af2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_application_insights_management_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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import ComponentsOperations, Operations, ProactiveDetectionConfigurationsOperations, WebTestsOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar proactive_detection_configurations: ProactiveDetectionConfigurationsOperations operations - :vartype proactive_detection_configurations: - azure.mgmt.applicationinsights.v2018_05_01_preview.aio.operations.ProactiveDetectionConfigurationsOperations - :ivar components: ComponentsOperations operations - :vartype components: - azure.mgmt.applicationinsights.v2018_05_01_preview.aio.operations.ComponentsOperations - :ivar operations: Operations operations - :vartype operations: - azure.mgmt.applicationinsights.v2018_05_01_preview.aio.operations.Operations - :ivar web_tests: WebTestsOperations operations - :vartype web_tests: - azure.mgmt.applicationinsights.v2018_05_01_preview.aio.operations.WebTestsOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2018-05-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.proactive_detection_configurations = ProactiveDetectionConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_configuration.py deleted file mode 100644 index 9767f3e61f45..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2018-05-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, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2018-05-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/__init__.py deleted file mode 100644 index 173ad1d7a923..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,31 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._proactive_detection_configurations_operations import ProactiveDetectionConfigurationsOperations # type: ignore -from ._components_operations import ComponentsOperations # type: ignore -from ._operations import Operations # type: ignore -from ._web_tests_operations import WebTestsOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ProactiveDetectionConfigurationsOperations", - "ComponentsOperations", - "Operations", - "WebTestsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_components_operations.py deleted file mode 100644 index ea53adcc3d74..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_components_operations.py +++ /dev/null @@ -1,817 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._components_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_purge_status_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_purge_request, - build_update_tags_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of all Application Insights components within a subscription. - - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of Application Insights components within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Deletes an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Returns an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: _models.ApplicationInsightsComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. - Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent or - IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(insight_properties, (IOBase, bytes)): - _content = insight_properties - else: - _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource - or IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(component_tags, (IOBase, bytes)): - _content = component_tags - else: - _json = self._serialize.body(component_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: _models.ComponentPurgeBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: Union[_models.ComponentPurgeBody, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBody or - IO[bytes] - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "ComponentPurgeBody") - - _request = build_purge_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_purge_status( - self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any - ) -> _models.ComponentPurgeStatusResponse: - """Get status for an ongoing purge operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param purge_id: In a purge status request, this is the Id of the operation the status of which - is returned. Required. - :type purge_id: str - :return: ComponentPurgeStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeStatusResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) - - _request = build_get_purge_status_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - purge_id=purge_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_operations.py deleted file mode 100644 index adacfeac2efe..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,133 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: - """List available operations. - - List the available operations supported by the Microsoft.EventGrid resource provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationsListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_proactive_detection_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_proactive_detection_configurations_operations.py deleted file mode 100644 index d0dd8d6421d2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_proactive_detection_configurations_operations.py +++ /dev/null @@ -1,350 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._proactive_detection_configurations_operations import ( - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`proactive_detection_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]: - """Gets a list of ProactiveDetection configurations of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: list of ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( - "cls", None - ) - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "[ApplicationInsightsComponentProactiveDetectionConfiguration]", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, configuration_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Get the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - configuration_id=configuration_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: _models.ApplicationInsightsComponentProactiveDetectionConfiguration, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Required. - :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Required. - :type proactive_detection_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: Union[ - _models.ApplicationInsightsComponentProactiveDetectionConfiguration, IO[bytes] - ], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Is either a - ApplicationInsightsComponentProactiveDetectionConfiguration type or a IO[bytes] type. Required. - :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - or IO[bytes] - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(proactive_detection_properties, (IOBase, bytes)): - _content = proactive_detection_properties - else: - _json = self._serialize.body( - proactive_detection_properties, "ApplicationInsightsComponentProactiveDetectionConfiguration" - ) - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - configuration_id=configuration_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_web_tests_operations.py deleted file mode 100644 index 75701d9e3edd..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/aio/operations/_web_tests_operations.py +++ /dev/null @@ -1,676 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._web_tests_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_component_request, - build_list_by_resource_group_request, - build_list_request, - build_update_tags_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WebTestsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`web_tests` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined within a specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: - """Get a specific Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: _models.WebTest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: Union[_models.WebTest, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. - Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - or IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_definition, (IOBase, bytes)): - _content = web_test_definition - else: - _json = self._serialize.body(web_test_definition, "WebTest") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Required. - :type web_test_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource or - IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_tags, (IOBase, bytes)): - _content = web_test_tags - else: - _json = self._serialize.body(web_test_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> None: - """Deletes an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: - """Get all Application Insights web test alerts definitions within a subscription. - - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_component( - self, component_name: str, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined for the specified component. - - :param component_name: The name of the Application Insights component resource. Required. - :type component_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_component_request( - component_name=component_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/__init__.py deleted file mode 100644 index e2752ee95e38..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/__init__.py +++ /dev/null @@ -1,90 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ApplicationInsightsComponent, - ApplicationInsightsComponentListResult, - ApplicationInsightsComponentProactiveDetectionConfiguration, - ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions, - ComponentPurgeBody, - ComponentPurgeBodyFilters, - ComponentPurgeResponse, - ComponentPurgeStatusResponse, - ComponentsResource, - HeaderField, - Operation, - OperationInfo, - OperationsListResult, - PrivateLinkScopedResource, - TagsResource, - WebTest, - WebTestGeolocation, - WebTestListResult, - WebTestPropertiesConfiguration, - WebTestPropertiesRequest, - WebTestPropertiesValidationRules, - WebTestPropertiesValidationRulesContentValidation, - WebtestsResource, -) - -from ._application_insights_management_client_enums import ( # type: ignore - ApplicationType, - FlowType, - IngestionMode, - PublicNetworkAccessType, - PurgeState, - RequestSource, - WebTestKind, - WebTestKindEnum, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsComponent", - "ApplicationInsightsComponentListResult", - "ApplicationInsightsComponentProactiveDetectionConfiguration", - "ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions", - "ComponentPurgeBody", - "ComponentPurgeBodyFilters", - "ComponentPurgeResponse", - "ComponentPurgeStatusResponse", - "ComponentsResource", - "HeaderField", - "Operation", - "OperationInfo", - "OperationsListResult", - "PrivateLinkScopedResource", - "TagsResource", - "WebTest", - "WebTestGeolocation", - "WebTestListResult", - "WebTestPropertiesConfiguration", - "WebTestPropertiesRequest", - "WebTestPropertiesValidationRules", - "WebTestPropertiesValidationRulesContentValidation", - "WebtestsResource", - "ApplicationType", - "FlowType", - "IngestionMode", - "PublicNetworkAccessType", - "PurgeState", - "RequestSource", - "WebTestKind", - "WebTestKindEnum", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_application_insights_management_client_enums.py deleted file mode 100644 index 7209e1a69e55..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_application_insights_management_client_enums.py +++ /dev/null @@ -1,76 +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 ApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application being monitored.""" - - WEB = "web" - OTHER = "other" - - -class FlowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Used by the Application Insights system to determine what kind of flow this component was - created by. This is to be set to 'Bluefield' when creating/updating a component via the REST - API. - """ - - BLUEFIELD = "Bluefield" - - -class IngestionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates the flow of the ingestion.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS = "ApplicationInsightsWithDiagnosticSettings" - LOG_ANALYTICS = "LogAnalytics" - - -class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The network access type for operating on the Application Insights Component. By default it is - Enabled. - """ - - ENABLED = "Enabled" - """Enables connectivity to Application Insights through public DNS.""" - DISABLED = "Disabled" - """Disables public connectivity to Application Insights through public DNS.""" - - -class PurgeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the operation represented by the requested Id.""" - - PENDING = "pending" - COMPLETED = "completed" - - -class RequestSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Describes what tool created this Application Insights component. Customers using this API - should set this to the default 'rest'. - """ - - REST = "rest" - - -class WebTestKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of WebTest that this web test watches. Choices are ping and multistep.""" - - PING = "ping" - MULTISTEP = "multistep" - - -class WebTestKindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of web test this is, valid choices are ping, multistep, basic, and standard.""" - - PING = "ping" - MULTISTEP = "multistep" - BASIC = "basic" - STANDARD = "standard" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_models_py3.py deleted file mode 100644 index de17e05eca7b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_models_py3.py +++ /dev/null @@ -1,1302 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from collections.abc import MutableMapping -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class ComponentsResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class ApplicationInsightsComponent(ComponentsResource): - """An Application Insights component definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: The kind of application that this component refers to, used to customize UI. This - value is a freeform string, values should typically be one of the following: web, ios, other, - store, java, phone. Required. - :vartype kind: str - :ivar application_id: The unique ID of your application. This field mirrors the 'Name' field - and cannot be changed. - :vartype application_id: str - :ivar app_id: Application Insights Unique ID for your Application. - :vartype app_id: str - :ivar application_type: Type of application being monitored. Known values are: "web" and - "other". - :vartype application_type: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationType - :ivar flow_type: Used by the Application Insights system to determine what kind of flow this - component was created by. This is to be set to 'Bluefield' when creating/updating a component - via the REST API. "Bluefield" - :vartype flow_type: str or ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.FlowType - :ivar request_source: Describes what tool created this Application Insights component. - Customers using this API should set this to the default 'rest'. "rest" - :vartype request_source: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.RequestSource - :ivar instrumentation_key: Application Insights Instrumentation key. A read-only value that - applications can use to identify the destination for all telemetry sent to Azure Application - Insights. This value will be supplied upon construction of each new Application Insights - component. - :vartype instrumentation_key: str - :ivar creation_date: Creation Date for the Application Insights component, in ISO 8601 format. - :vartype creation_date: ~datetime.datetime - :ivar tenant_id: Azure Tenant Id. - :vartype tenant_id: str - :ivar hockey_app_id: The unique application ID created when a new application is added to - HockeyApp, used for communications with HockeyApp. - :vartype hockey_app_id: str - :ivar hockey_app_token: Token used to authenticate communications with between Application - Insights and HockeyApp. - :vartype hockey_app_token: str - :ivar provisioning_state: Current state of this component: whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. - :vartype provisioning_state: str - :ivar sampling_percentage: Percentage of the data produced by the application being monitored - that is being sampled for Application Insights telemetry. - :vartype sampling_percentage: float - :ivar connection_string: Application Insights component connection string. - :vartype connection_string: str - :ivar retention_in_days: Retention period in days. - :vartype retention_in_days: int - :ivar disable_ip_masking: Disable IP masking. - :vartype disable_ip_masking: bool - :ivar immediate_purge_data_on30_days: Purge data immediately after 30 days. - :vartype immediate_purge_data_on30_days: bool - :ivar private_link_scoped_resources: List of linked private link scope resources. - :vartype private_link_scoped_resources: - list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PrivateLinkScopedResource] - :ivar public_network_access_for_ingestion: The network access type for accessing Application - Insights ingestion. Known values are: "Enabled" and "Disabled". - :vartype public_network_access_for_ingestion: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PublicNetworkAccessType - :ivar public_network_access_for_query: The network access type for accessing Application - Insights query. Known values are: "Enabled" and "Disabled". - :vartype public_network_access_for_query: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PublicNetworkAccessType - :ivar ingestion_mode: Indicates the flow of the ingestion. Known values are: - "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". - :vartype ingestion_mode: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.IngestionMode - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "kind": {"required": True}, - "application_id": {"readonly": True}, - "app_id": {"readonly": True}, - "instrumentation_key": {"readonly": True}, - "creation_date": {"readonly": True}, - "tenant_id": {"readonly": True}, - "hockey_app_token": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "connection_string": {"readonly": True}, - "private_link_scoped_resources": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "application_id": {"key": "properties.ApplicationId", "type": "str"}, - "app_id": {"key": "properties.AppId", "type": "str"}, - "application_type": {"key": "properties.Application_Type", "type": "str"}, - "flow_type": {"key": "properties.Flow_Type", "type": "str"}, - "request_source": {"key": "properties.Request_Source", "type": "str"}, - "instrumentation_key": {"key": "properties.InstrumentationKey", "type": "str"}, - "creation_date": {"key": "properties.CreationDate", "type": "iso-8601"}, - "tenant_id": {"key": "properties.TenantId", "type": "str"}, - "hockey_app_id": {"key": "properties.HockeyAppId", "type": "str"}, - "hockey_app_token": {"key": "properties.HockeyAppToken", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "sampling_percentage": {"key": "properties.SamplingPercentage", "type": "float"}, - "connection_string": {"key": "properties.ConnectionString", "type": "str"}, - "retention_in_days": {"key": "properties.RetentionInDays", "type": "int"}, - "disable_ip_masking": {"key": "properties.DisableIpMasking", "type": "bool"}, - "immediate_purge_data_on30_days": {"key": "properties.ImmediatePurgeDataOn30Days", "type": "bool"}, - "private_link_scoped_resources": { - "key": "properties.PrivateLinkScopedResources", - "type": "[PrivateLinkScopedResource]", - }, - "public_network_access_for_ingestion": {"key": "properties.publicNetworkAccessForIngestion", "type": "str"}, - "public_network_access_for_query": {"key": "properties.publicNetworkAccessForQuery", "type": "str"}, - "ingestion_mode": {"key": "properties.IngestionMode", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - kind: str, - tags: Optional[dict[str, str]] = None, - application_type: Union[str, "_models.ApplicationType"] = "web", - flow_type: Union[str, "_models.FlowType"] = "Bluefield", - request_source: Union[str, "_models.RequestSource"] = "rest", - hockey_app_id: Optional[str] = None, - sampling_percentage: Optional[float] = None, - retention_in_days: int = 90, - disable_ip_masking: Optional[bool] = None, - immediate_purge_data_on30_days: Optional[bool] = None, - public_network_access_for_ingestion: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", - public_network_access_for_query: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", - ingestion_mode: Union[str, "_models.IngestionMode"] = "ApplicationInsights", - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword kind: The kind of application that this component refers to, used to customize UI. - This value is a freeform string, values should typically be one of the following: web, ios, - other, store, java, phone. Required. - :paramtype kind: str - :keyword application_type: Type of application being monitored. Known values are: "web" and - "other". - :paramtype application_type: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationType - :keyword flow_type: Used by the Application Insights system to determine what kind of flow this - component was created by. This is to be set to 'Bluefield' when creating/updating a component - via the REST API. "Bluefield" - :paramtype flow_type: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.FlowType - :keyword request_source: Describes what tool created this Application Insights component. - Customers using this API should set this to the default 'rest'. "rest" - :paramtype request_source: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.RequestSource - :keyword hockey_app_id: The unique application ID created when a new application is added to - HockeyApp, used for communications with HockeyApp. - :paramtype hockey_app_id: str - :keyword sampling_percentage: Percentage of the data produced by the application being - monitored that is being sampled for Application Insights telemetry. - :paramtype sampling_percentage: float - :keyword retention_in_days: Retention period in days. - :paramtype retention_in_days: int - :keyword disable_ip_masking: Disable IP masking. - :paramtype disable_ip_masking: bool - :keyword immediate_purge_data_on30_days: Purge data immediately after 30 days. - :paramtype immediate_purge_data_on30_days: bool - :keyword public_network_access_for_ingestion: The network access type for accessing Application - Insights ingestion. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access_for_ingestion: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PublicNetworkAccessType - :keyword public_network_access_for_query: The network access type for accessing Application - Insights query. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access_for_query: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PublicNetworkAccessType - :keyword ingestion_mode: Indicates the flow of the ingestion. Known values are: - "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". - :paramtype ingestion_mode: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.IngestionMode - """ - super().__init__(location=location, tags=tags, **kwargs) - self.kind = kind - self.application_id: Optional[str] = None - self.app_id: Optional[str] = None - self.application_type = application_type - self.flow_type = flow_type - self.request_source = request_source - self.instrumentation_key: Optional[str] = None - self.creation_date: Optional[datetime.datetime] = None - self.tenant_id: Optional[str] = None - self.hockey_app_id = hockey_app_id - self.hockey_app_token: Optional[str] = None - self.provisioning_state: Optional[str] = None - self.sampling_percentage = sampling_percentage - self.connection_string: Optional[str] = None - self.retention_in_days = retention_in_days - self.disable_ip_masking = disable_ip_masking - self.immediate_purge_data_on30_days = immediate_purge_data_on30_days - self.private_link_scoped_resources: Optional[list["_models.PrivateLinkScopedResource"]] = None - self.public_network_access_for_ingestion = public_network_access_for_ingestion - self.public_network_access_for_query = public_network_access_for_query - self.ingestion_mode = ingestion_mode - - -class ApplicationInsightsComponentListResult(_serialization.Model): - """Describes the list of Application Insights Resources. - - All required parameters must be populated in order to send to server. - - :ivar value: List of Application Insights component definitions. Required. - :vartype value: - list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] - :ivar next_link: The URI to get the next set of Application Insights component definitions if - too many components where returned in the result set. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationInsightsComponent]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.ApplicationInsightsComponent"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of Application Insights component definitions. Required. - :paramtype value: - list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] - :keyword next_link: The URI to get the next set of Application Insights component definitions - if too many components where returned in the result set. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApplicationInsightsComponentProactiveDetectionConfiguration( - _serialization.Model -): # pylint: disable=name-too-long - """A ProactiveDetection configuration definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar name_properties_name: The rule name. - :vartype name_properties_name: str - :ivar enabled: A flag that indicates whether this rule is enabled by the user. - :vartype enabled: bool - :ivar send_emails_to_subscription_owners: A flag that indicated whether notifications on this - rule should be sent to subscription owners. - :vartype send_emails_to_subscription_owners: bool - :ivar custom_emails: Custom email addresses for this rule notifications. - :vartype custom_emails: list[str] - :ivar last_updated_time: The last time this rule was updated. - :vartype last_updated_time: str - :ivar rule_definitions: Static definitions of the ProactiveDetection configuration rule (same - values for all components). - :vartype rule_definitions: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions - """ - - _validation = { - "id": {"readonly": True}, - "type": {"readonly": True}, - "name_properties_name": {"readonly": True}, - "last_updated_time": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "name_properties_name": {"key": "properties.Name", "type": "str"}, - "enabled": {"key": "properties.Enabled", "type": "bool"}, - "send_emails_to_subscription_owners": {"key": "properties.SendEmailsToSubscriptionOwners", "type": "bool"}, - "custom_emails": {"key": "properties.CustomEmails", "type": "[str]"}, - "last_updated_time": {"key": "properties.LastUpdatedTime", "type": "str"}, - "rule_definitions": { - "key": "properties.RuleDefinitions", - "type": "ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions", - }, - } - - def __init__( - self, - *, - name: Optional[str] = None, - location: Optional[str] = None, - enabled: Optional[bool] = None, - send_emails_to_subscription_owners: Optional[bool] = None, - custom_emails: Optional[list[str]] = None, - rule_definitions: Optional[ - "_models.ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions" - ] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Azure resource name. - :paramtype name: str - :keyword location: Resource location. - :paramtype location: str - :keyword enabled: A flag that indicates whether this rule is enabled by the user. - :paramtype enabled: bool - :keyword send_emails_to_subscription_owners: A flag that indicated whether notifications on - this rule should be sent to subscription owners. - :paramtype send_emails_to_subscription_owners: bool - :keyword custom_emails: Custom email addresses for this rule notifications. - :paramtype custom_emails: list[str] - :keyword rule_definitions: Static definitions of the ProactiveDetection configuration rule - (same values for all components). - :paramtype rule_definitions: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name = name - self.type: Optional[str] = None - self.location = location - self.name_properties_name: Optional[str] = None - self.enabled = enabled - self.send_emails_to_subscription_owners = send_emails_to_subscription_owners - self.custom_emails = custom_emails - self.last_updated_time: Optional[str] = None - self.rule_definitions = rule_definitions - - -class ApplicationInsightsComponentProactiveDetectionConfigurationPropertiesRuleDefinitions( - _serialization.Model -): # pylint: disable=name-too-long - """Static definitions of the ProactiveDetection configuration rule (same values for all - components). - - :ivar name: The rule name. - :vartype name: str - :ivar display_name: The rule name as it is displayed in UI. - :vartype display_name: str - :ivar description: The rule description. - :vartype description: str - :ivar help_url: URL which displays additional info about the proactive detection rule. - :vartype help_url: str - :ivar is_hidden: A flag indicating whether the rule is hidden (from the UI). - :vartype is_hidden: bool - :ivar is_enabled_by_default: A flag indicating whether the rule is enabled by default. - :vartype is_enabled_by_default: bool - :ivar is_in_preview: A flag indicating whether the rule is in preview. - :vartype is_in_preview: bool - :ivar supports_email_notifications: A flag indicating whether email notifications are supported - for detections for this rule. - :vartype supports_email_notifications: bool - """ - - _attribute_map = { - "name": {"key": "Name", "type": "str"}, - "display_name": {"key": "DisplayName", "type": "str"}, - "description": {"key": "Description", "type": "str"}, - "help_url": {"key": "HelpUrl", "type": "str"}, - "is_hidden": {"key": "IsHidden", "type": "bool"}, - "is_enabled_by_default": {"key": "IsEnabledByDefault", "type": "bool"}, - "is_in_preview": {"key": "IsInPreview", "type": "bool"}, - "supports_email_notifications": {"key": "SupportsEmailNotifications", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - description: Optional[str] = None, - help_url: Optional[str] = None, - is_hidden: Optional[bool] = None, - is_enabled_by_default: Optional[bool] = None, - is_in_preview: Optional[bool] = None, - supports_email_notifications: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The rule name. - :paramtype name: str - :keyword display_name: The rule name as it is displayed in UI. - :paramtype display_name: str - :keyword description: The rule description. - :paramtype description: str - :keyword help_url: URL which displays additional info about the proactive detection rule. - :paramtype help_url: str - :keyword is_hidden: A flag indicating whether the rule is hidden (from the UI). - :paramtype is_hidden: bool - :keyword is_enabled_by_default: A flag indicating whether the rule is enabled by default. - :paramtype is_enabled_by_default: bool - :keyword is_in_preview: A flag indicating whether the rule is in preview. - :paramtype is_in_preview: bool - :keyword supports_email_notifications: A flag indicating whether email notifications are - supported for detections for this rule. - :paramtype supports_email_notifications: bool - """ - super().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.description = description - self.help_url = help_url - self.is_hidden = is_hidden - self.is_enabled_by_default = is_enabled_by_default - self.is_in_preview = is_in_preview - self.supports_email_notifications = supports_email_notifications - - -class ComponentPurgeBody(_serialization.Model): - """Describes the body of a purge request for an App Insights component. - - All required parameters must be populated in order to send to server. - - :ivar table: Table from which to purge data. Required. - :vartype table: str - :ivar filters: The set of columns and filters (queries) to run over them to purge the resulting - data. Required. - :vartype filters: - list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBodyFilters] - """ - - _validation = { - "table": {"required": True}, - "filters": {"required": True}, - } - - _attribute_map = { - "table": {"key": "table", "type": "str"}, - "filters": {"key": "filters", "type": "[ComponentPurgeBodyFilters]"}, - } - - def __init__(self, *, table: str, filters: list["_models.ComponentPurgeBodyFilters"], **kwargs: Any) -> None: - """ - :keyword table: Table from which to purge data. Required. - :paramtype table: str - :keyword filters: The set of columns and filters (queries) to run over them to purge the - resulting data. Required. - :paramtype filters: - list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBodyFilters] - """ - super().__init__(**kwargs) - self.table = table - self.filters = filters - - -class ComponentPurgeBodyFilters(_serialization.Model): - """User-defined filters to return data which will be purged from the table. - - :ivar column: The column of the table over which the given query should run. - :vartype column: str - :ivar operator: A query operator to evaluate over the provided column and value(s). Supported - operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would - in a KQL query. - :vartype operator: str - :ivar value: the value for the operator to function over. This can be a number (e.g., > 100), a - string (timestamp >= '2017-09-01') or array of values. - :vartype value: any - :ivar key: When filtering over custom dimensions, this key will be used as the name of the - custom dimension. - :vartype key: str - """ - - _attribute_map = { - "column": {"key": "column", "type": "str"}, - "operator": {"key": "operator", "type": "str"}, - "value": {"key": "value", "type": "object"}, - "key": {"key": "key", "type": "str"}, - } - - def __init__( - self, - *, - column: Optional[str] = None, - operator: Optional[str] = None, - value: Optional[Any] = None, - key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword column: The column of the table over which the given query should run. - :paramtype column: str - :keyword operator: A query operator to evaluate over the provided column and value(s). - Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as - they would in a KQL query. - :paramtype operator: str - :keyword value: the value for the operator to function over. This can be a number (e.g., > - 100), a string (timestamp >= '2017-09-01') or array of values. - :paramtype value: any - :keyword key: When filtering over custom dimensions, this key will be used as the name of the - custom dimension. - :paramtype key: str - """ - super().__init__(**kwargs) - self.column = column - self.operator = operator - self.value = value - self.key = key - - -class ComponentPurgeResponse(_serialization.Model): - """Response containing operationId for a specific purge action. - - All required parameters must be populated in order to send to server. - - :ivar operation_id: Id to use when querying for status for a particular purge operation. - Required. - :vartype operation_id: str - """ - - _validation = { - "operation_id": {"required": True}, - } - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - } - - def __init__(self, *, operation_id: str, **kwargs: Any) -> None: - """ - :keyword operation_id: Id to use when querying for status for a particular purge operation. - Required. - :paramtype operation_id: str - """ - super().__init__(**kwargs) - self.operation_id = operation_id - - -class ComponentPurgeStatusResponse(_serialization.Model): - """Response containing status for a specific purge operation. - - All required parameters must be populated in order to send to server. - - :ivar status: Status of the operation represented by the requested Id. Required. Known values - are: "pending" and "completed". - :vartype status: str or ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PurgeState - """ - - _validation = { - "status": {"required": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, *, status: Union[str, "_models.PurgeState"], **kwargs: Any) -> None: - """ - :keyword status: Status of the operation represented by the requested Id. Required. Known - values are: "pending" and "completed". - :paramtype status: str or ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.PurgeState - """ - super().__init__(**kwargs) - self.status = status - - -class HeaderField(_serialization.Model): - """A header to add to the WebTest. - - :ivar header_field_name: The name of the header. - :vartype header_field_name: str - :ivar header_field_value: The value of the header. - :vartype header_field_value: str - """ - - _attribute_map = { - "header_field_name": {"key": "key", "type": "str"}, - "header_field_value": {"key": "value", "type": "str"}, - } - - def __init__( - self, *, header_field_name: Optional[str] = None, header_field_value: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword header_field_name: The name of the header. - :paramtype header_field_name: str - :keyword header_field_value: The value of the header. - :paramtype header_field_value: str - """ - super().__init__(**kwargs) - self.header_field_name = header_field_name - self.header_field_value = header_field_value - - -class Operation(_serialization.Model): - """Represents an operation returned by the GetOperations request. - - :ivar name: Name of the operation. - :vartype name: str - :ivar display: Display name of the operation. - :vartype display: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.OperationInfo - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: JSON - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationInfo"}, - "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "object"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.OperationInfo"] = None, - origin: Optional[str] = None, - properties: Optional[JSON] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the operation. - :paramtype name: str - :keyword display: Display name of the operation. - :paramtype display: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.OperationInfo - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: JSON - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - self.properties = properties - - -class OperationInfo(_serialization.Model): - """Information about an operation. - - :ivar provider: Name of the provider. - :vartype provider: str - :ivar resource: Name of the resource type. - :vartype resource: str - :ivar operation: Name of the operation. - :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: Name of the provider. - :paramtype provider: str - :keyword resource: Name of the resource type. - :paramtype resource: str - :keyword operation: Name of the operation. - :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 OperationsListResult(_serialization.Model): - """Result of the List Operations operation. - - :ivar value: A collection of operations. - :vartype value: list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.Operation] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: A collection of operations. - :paramtype value: list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.Operation] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PrivateLinkScopedResource(_serialization.Model): - """The private link scope resource reference. - - :ivar resource_id: The full resource Id of the private link scope resource. - :vartype resource_id: str - :ivar scope_id: The private link scope unique Identifier. - :vartype scope_id: str - """ - - _attribute_map = { - "resource_id": {"key": "ResourceId", "type": "str"}, - "scope_id": {"key": "ScopeId", "type": "str"}, - } - - def __init__(self, *, resource_id: Optional[str] = None, scope_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resource_id: The full resource Id of the private link scope resource. - :paramtype resource_id: str - :keyword scope_id: The private link scope unique Identifier. - :paramtype scope_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.scope_id = scope_id - - -class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on a - WebTest instance. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class WebtestsResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class WebTest(WebtestsResource): - """An Application Insights WebTest definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: The kind of WebTest that this web test watches. Choices are ping and multistep. - Known values are: "ping" and "multistep". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestKind - :ivar synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as the - Name field. - :vartype synthetic_monitor_id: str - :ivar web_test_name: User defined name if this WebTest. - :vartype web_test_name: str - :ivar description: User defined description for this WebTest. - :vartype description: str - :ivar enabled: Is the test actively being monitored. - :vartype enabled: bool - :ivar frequency: Interval in seconds between test runs for this WebTest. Default value is 300. - :vartype frequency: int - :ivar timeout: Seconds until this WebTest will timeout and fail. Default value is 30. - :vartype timeout: int - :ivar web_test_kind: The kind of web test this is, valid choices are ping, multistep, basic, - and standard. Known values are: "ping", "multistep", "basic", and "standard". - :vartype web_test_kind: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestKindEnum - :ivar retry_enabled: Allow for retries should this WebTest fail. - :vartype retry_enabled: bool - :ivar locations: A list of where to physically run the tests from to give global coverage for - accessibility of your application. - :vartype locations: - list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestGeolocation] - :ivar configuration: An XML configuration specification for a WebTest. - :vartype configuration: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesConfiguration - :ivar provisioning_state: Current state of this component, whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. - :vartype provisioning_state: str - :ivar request: The collection of request properties. - :vartype request: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesRequest - :ivar validation_rules: The collection of validation rule properties. - :vartype validation_rules: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesValidationRules - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "synthetic_monitor_id": {"key": "properties.SyntheticMonitorId", "type": "str"}, - "web_test_name": {"key": "properties.Name", "type": "str"}, - "description": {"key": "properties.Description", "type": "str"}, - "enabled": {"key": "properties.Enabled", "type": "bool"}, - "frequency": {"key": "properties.Frequency", "type": "int"}, - "timeout": {"key": "properties.Timeout", "type": "int"}, - "web_test_kind": {"key": "properties.Kind", "type": "str"}, - "retry_enabled": {"key": "properties.RetryEnabled", "type": "bool"}, - "locations": {"key": "properties.Locations", "type": "[WebTestGeolocation]"}, - "configuration": {"key": "properties.Configuration", "type": "WebTestPropertiesConfiguration"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "request": {"key": "properties.Request", "type": "WebTestPropertiesRequest"}, - "validation_rules": {"key": "properties.ValidationRules", "type": "WebTestPropertiesValidationRules"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - kind: Union[str, "_models.WebTestKind"] = "ping", - synthetic_monitor_id: Optional[str] = None, - web_test_name: Optional[str] = None, - description: Optional[str] = None, - enabled: Optional[bool] = None, - frequency: int = 300, - timeout: int = 30, - web_test_kind: Union[str, "_models.WebTestKindEnum"] = "ping", - retry_enabled: Optional[bool] = None, - locations: Optional[list["_models.WebTestGeolocation"]] = None, - configuration: Optional["_models.WebTestPropertiesConfiguration"] = None, - request: Optional["_models.WebTestPropertiesRequest"] = None, - validation_rules: Optional["_models.WebTestPropertiesValidationRules"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword kind: The kind of WebTest that this web test watches. Choices are ping and multistep. - Known values are: "ping" and "multistep". - :paramtype kind: str or ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestKind - :keyword synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as - the Name field. - :paramtype synthetic_monitor_id: str - :keyword web_test_name: User defined name if this WebTest. - :paramtype web_test_name: str - :keyword description: User defined description for this WebTest. - :paramtype description: str - :keyword enabled: Is the test actively being monitored. - :paramtype enabled: bool - :keyword frequency: Interval in seconds between test runs for this WebTest. Default value is - 300. - :paramtype frequency: int - :keyword timeout: Seconds until this WebTest will timeout and fail. Default value is 30. - :paramtype timeout: int - :keyword web_test_kind: The kind of web test this is, valid choices are ping, multistep, basic, - and standard. Known values are: "ping", "multistep", "basic", and "standard". - :paramtype web_test_kind: str or - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestKindEnum - :keyword retry_enabled: Allow for retries should this WebTest fail. - :paramtype retry_enabled: bool - :keyword locations: A list of where to physically run the tests from to give global coverage - for accessibility of your application. - :paramtype locations: - list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestGeolocation] - :keyword configuration: An XML configuration specification for a WebTest. - :paramtype configuration: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesConfiguration - :keyword request: The collection of request properties. - :paramtype request: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesRequest - :keyword validation_rules: The collection of validation rule properties. - :paramtype validation_rules: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesValidationRules - """ - super().__init__(location=location, tags=tags, **kwargs) - self.kind = kind - self.synthetic_monitor_id = synthetic_monitor_id - self.web_test_name = web_test_name - self.description = description - self.enabled = enabled - self.frequency = frequency - self.timeout = timeout - self.web_test_kind = web_test_kind - self.retry_enabled = retry_enabled - self.locations = locations - self.configuration = configuration - self.provisioning_state: Optional[str] = None - self.request = request - self.validation_rules = validation_rules - - -class WebTestGeolocation(_serialization.Model): - """Geo-physical location to run a WebTest from. You must specify one or more locations for the - test to run from. - - :ivar location: Location ID for the WebTest to run from. - :vartype location: str - """ - - _attribute_map = { - "location": {"key": "Id", "type": "str"}, - } - - def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword location: Location ID for the WebTest to run from. - :paramtype location: str - """ - super().__init__(**kwargs) - self.location = location - - -class WebTestListResult(_serialization.Model): - """A list of 0 or more Application Insights WebTest definitions. - - All required parameters must be populated in order to send to server. - - :ivar value: Set of Application Insights WebTest definitions. Required. - :vartype value: list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] - :ivar next_link: The link to get the next part of the returned list of WebTest, should the - return set be too large for a single request. May be null. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[WebTest]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.WebTest"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Set of Application Insights WebTest definitions. Required. - :paramtype value: list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] - :keyword next_link: The link to get the next part of the returned list of WebTest, should the - return set be too large for a single request. May be null. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class WebTestPropertiesConfiguration(_serialization.Model): - """An XML configuration specification for a WebTest. - - :ivar web_test: The XML specification of a WebTest to run against an application. - :vartype web_test: str - """ - - _attribute_map = { - "web_test": {"key": "WebTest", "type": "str"}, - } - - def __init__(self, *, web_test: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword web_test: The XML specification of a WebTest to run against an application. - :paramtype web_test: str - """ - super().__init__(**kwargs) - self.web_test = web_test - - -class WebTestPropertiesRequest(_serialization.Model): - """The collection of request properties. - - :ivar request_url: Url location to test. - :vartype request_url: str - :ivar headers: List of headers and their values to add to the WebTest call. - :vartype headers: list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.HeaderField] - :ivar http_verb: Http verb to use for this web test. - :vartype http_verb: str - :ivar request_body: Base64 encoded string body to send with this web test. - :vartype request_body: str - :ivar parse_dependent_requests: Parse Dependent request for this WebTest. - :vartype parse_dependent_requests: bool - :ivar follow_redirects: Follow redirects for this web test. - :vartype follow_redirects: bool - """ - - _attribute_map = { - "request_url": {"key": "RequestUrl", "type": "str"}, - "headers": {"key": "Headers", "type": "[HeaderField]"}, - "http_verb": {"key": "HttpVerb", "type": "str"}, - "request_body": {"key": "RequestBody", "type": "str"}, - "parse_dependent_requests": {"key": "ParseDependentRequests", "type": "bool"}, - "follow_redirects": {"key": "FollowRedirects", "type": "bool"}, - } - - def __init__( - self, - *, - request_url: Optional[str] = None, - headers: Optional[list["_models.HeaderField"]] = None, - http_verb: Optional[str] = None, - request_body: Optional[str] = None, - parse_dependent_requests: Optional[bool] = None, - follow_redirects: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword request_url: Url location to test. - :paramtype request_url: str - :keyword headers: List of headers and their values to add to the WebTest call. - :paramtype headers: - list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.HeaderField] - :keyword http_verb: Http verb to use for this web test. - :paramtype http_verb: str - :keyword request_body: Base64 encoded string body to send with this web test. - :paramtype request_body: str - :keyword parse_dependent_requests: Parse Dependent request for this WebTest. - :paramtype parse_dependent_requests: bool - :keyword follow_redirects: Follow redirects for this web test. - :paramtype follow_redirects: bool - """ - super().__init__(**kwargs) - self.request_url = request_url - self.headers = headers - self.http_verb = http_verb - self.request_body = request_body - self.parse_dependent_requests = parse_dependent_requests - self.follow_redirects = follow_redirects - - -class WebTestPropertiesValidationRules(_serialization.Model): - """The collection of validation rule properties. - - :ivar content_validation: The collection of content validation properties. - :vartype content_validation: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesValidationRulesContentValidation - :ivar ssl_check: Checks to see if the SSL cert is still valid. - :vartype ssl_check: bool - :ivar ssl_cert_remaining_lifetime_check: A number of days to check still remain before the the - existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. - :vartype ssl_cert_remaining_lifetime_check: int - :ivar expected_http_status_code: Validate that the WebTest returns the http status code - provided. - :vartype expected_http_status_code: int - :ivar ignore_https_status_code: When set, validation will ignore the status code. - :vartype ignore_https_status_code: bool - """ - - _attribute_map = { - "content_validation": {"key": "ContentValidation", "type": "WebTestPropertiesValidationRulesContentValidation"}, - "ssl_check": {"key": "SSLCheck", "type": "bool"}, - "ssl_cert_remaining_lifetime_check": {"key": "SSLCertRemainingLifetimeCheck", "type": "int"}, - "expected_http_status_code": {"key": "ExpectedHttpStatusCode", "type": "int"}, - "ignore_https_status_code": {"key": "IgnoreHttpsStatusCode", "type": "bool"}, - } - - def __init__( - self, - *, - content_validation: Optional["_models.WebTestPropertiesValidationRulesContentValidation"] = None, - ssl_check: Optional[bool] = None, - ssl_cert_remaining_lifetime_check: Optional[int] = None, - expected_http_status_code: Optional[int] = None, - ignore_https_status_code: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword content_validation: The collection of content validation properties. - :paramtype content_validation: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTestPropertiesValidationRulesContentValidation - :keyword ssl_check: Checks to see if the SSL cert is still valid. - :paramtype ssl_check: bool - :keyword ssl_cert_remaining_lifetime_check: A number of days to check still remain before the - the existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. - :paramtype ssl_cert_remaining_lifetime_check: int - :keyword expected_http_status_code: Validate that the WebTest returns the http status code - provided. - :paramtype expected_http_status_code: int - :keyword ignore_https_status_code: When set, validation will ignore the status code. - :paramtype ignore_https_status_code: bool - """ - super().__init__(**kwargs) - self.content_validation = content_validation - self.ssl_check = ssl_check - self.ssl_cert_remaining_lifetime_check = ssl_cert_remaining_lifetime_check - self.expected_http_status_code = expected_http_status_code - self.ignore_https_status_code = ignore_https_status_code - - -class WebTestPropertiesValidationRulesContentValidation(_serialization.Model): # pylint: disable=name-too-long - """The collection of content validation properties. - - :ivar content_match: Content to look for in the return of the WebTest. Must not be null or - empty. - :vartype content_match: str - :ivar ignore_case: When set, this value makes the ContentMatch validation case insensitive. - :vartype ignore_case: bool - :ivar pass_if_text_found: When true, validation will pass if there is a match for the - ContentMatch string. If false, validation will fail if there is a match. - :vartype pass_if_text_found: bool - """ - - _attribute_map = { - "content_match": {"key": "ContentMatch", "type": "str"}, - "ignore_case": {"key": "IgnoreCase", "type": "bool"}, - "pass_if_text_found": {"key": "PassIfTextFound", "type": "bool"}, - } - - def __init__( - self, - *, - content_match: Optional[str] = None, - ignore_case: Optional[bool] = None, - pass_if_text_found: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword content_match: Content to look for in the return of the WebTest. Must not be null or - empty. - :paramtype content_match: str - :keyword ignore_case: When set, this value makes the ContentMatch validation case insensitive. - :paramtype ignore_case: bool - :keyword pass_if_text_found: When true, validation will pass if there is a match for the - ContentMatch string. If false, validation will fail if there is a match. - :paramtype pass_if_text_found: bool - """ - super().__init__(**kwargs) - self.content_match = content_match - self.ignore_case = ignore_case - self.pass_if_text_found = pass_if_text_found diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/__init__.py deleted file mode 100644 index 173ad1d7a923..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/__init__.py +++ /dev/null @@ -1,31 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._proactive_detection_configurations_operations import ProactiveDetectionConfigurationsOperations # type: ignore -from ._components_operations import ComponentsOperations # type: ignore -from ._operations import Operations # type: ignore -from ._web_tests_operations import WebTestsOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ProactiveDetectionConfigurationsOperations", - "ComponentsOperations", - "Operations", - "WebTestsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_components_operations.py deleted file mode 100644 index 940cd05084f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_components_operations.py +++ /dev/null @@ -1,1063 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components") - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2018-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, 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", "2018-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_tags_request( - resource_group_name: str, 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", "2018-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_purge_request( - resource_group_name: str, 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", "2018-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_purge_status_request( - resource_group_name: str, resource_name: str, purge_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", "2018-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.ApplicationInsightsManagementClient`'s - :attr:`components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of all Application Insights components within a subscription. - - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of Application Insights components within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Deletes an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ApplicationInsightsComponent: - """Returns an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: _models.ApplicationInsightsComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. - Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent or - IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(insight_properties, (IOBase, bytes)): - _content = insight_properties - else: - _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource - or IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(component_tags, (IOBase, bytes)): - _content = component_tags - else: - _json = self._serialize.body(component_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def purge( - self, - resource_group_name: str, - resource_name: str, - body: _models.ComponentPurgeBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def purge( - self, - resource_group_name: str, - resource_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def purge( - self, - resource_group_name: str, - resource_name: str, - body: Union[_models.ComponentPurgeBody, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeBody or - IO[bytes] - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "ComponentPurgeBody") - - _request = build_purge_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_purge_status( - self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any - ) -> _models.ComponentPurgeStatusResponse: - """Get status for an ongoing purge operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param purge_id: In a purge status request, this is the Id of the operation the status of which - is returned. Required. - :type purge_id: str - :return: ComponentPurgeStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ComponentPurgeStatusResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) - - _request = build_get_purge_status_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - purge_id=purge_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_operations.py deleted file mode 100644 index 3fd5a0a3722a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_operations.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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_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-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/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.applicationinsights.v2018_05_01_preview.ApplicationInsightsManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: - """List available operations. - - List the available operations supported by the Microsoft.EventGrid resource provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OperationsListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_proactive_detection_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_proactive_detection_configurations_operations.py deleted file mode 100644 index 2937dd2d35d4..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_proactive_detection_configurations_operations.py +++ /dev/null @@ -1,452 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, 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", "2018-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, resource_name: str, configuration_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", "2018-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, configuration_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", "2018-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "ConfigurationId": _SERIALIZER.url("configuration_id", configuration_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class ProactiveDetectionConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.ApplicationInsightsManagementClient`'s - :attr:`proactive_detection_configurations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]: - """Gets a list of ProactiveDetection configurations of an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: list of ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - list[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[List[_models.ApplicationInsightsComponentProactiveDetectionConfiguration]] = kwargs.pop( - "cls", None - ) - - _request = build_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "[ApplicationInsightsComponentProactiveDetectionConfiguration]", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, configuration_id: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Get the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - configuration_id=configuration_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: _models.ApplicationInsightsComponentProactiveDetectionConfiguration, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Required. - :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Required. - :type proactive_detection_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - configuration_id: str, - proactive_detection_properties: Union[ - _models.ApplicationInsightsComponentProactiveDetectionConfiguration, IO[bytes] - ], - **kwargs: Any - ) -> _models.ApplicationInsightsComponentProactiveDetectionConfiguration: - """Update the ProactiveDetection configuration for this configuration id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param configuration_id: The ProactiveDetection configuration ID. This is unique within a - Application Insights component. Required. - :type configuration_id: str - :param proactive_detection_properties: Properties that need to be specified to update the - ProactiveDetection configuration. Is either a - ApplicationInsightsComponentProactiveDetectionConfiguration type or a IO[bytes] type. Required. - :type proactive_detection_properties: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - or IO[bytes] - :return: ApplicationInsightsComponentProactiveDetectionConfiguration or the result of - cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.ApplicationInsightsComponentProactiveDetectionConfiguration - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponentProactiveDetectionConfiguration] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(proactive_detection_properties, (IOBase, bytes)): - _content = proactive_detection_properties - else: - _json = self._serialize.body( - proactive_detection_properties, "ApplicationInsightsComponentProactiveDetectionConfiguration" - ) - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - configuration_id=configuration_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize( - "ApplicationInsightsComponentProactiveDetectionConfiguration", pipeline_response.http_response - ) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_web_tests_operations.py deleted file mode 100644 index 5730b3b21aa2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/operations/_web_tests_operations.py +++ /dev/null @@ -1,889 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, web_test_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", "2018-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "webTestName": _SERIALIZER.url("web_test_name", web_test_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_create_or_update_request( - resource_group_name: str, web_test_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", "2018-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_tags_request( - resource_group_name: str, web_test_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", "2018-05-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, web_test_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - 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 - ), - "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests") - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_component_request( - component_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-05-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{componentName}/webtests", - ) - path_format_arguments = { - "componentName": _SERIALIZER.url("component_name", component_name, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class WebTestsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2018_05_01_preview.ApplicationInsightsManagementClient`'s - :attr:`web_tests` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined within a specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: - """Get a specific Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: _models.WebTest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: Union[_models.WebTest, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. - Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - or IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_definition, (IOBase, bytes)): - _content = web_test_definition - else: - _json = self._serialize.body(web_test_definition, "WebTest") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Required. - :type web_test_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to set into the web test instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.TagsResource or - IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_tags, (IOBase, bytes)): - _content = web_test_tags - else: - _json = self._serialize.body(web_test_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, web_test_name: str, **kwargs: Any - ) -> None: - """Deletes an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.WebTest"]: - """Get all Application Insights web test alerts definitions within a subscription. - - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_component( - self, component_name: str, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined for the specified component. - - :param component_name: The name of the Application Insights component resource. Required. - :type component_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_05_01_preview.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_component_request( - component_name=component_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_05_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_application_insights_management_client.py deleted file mode 100644 index 1e21ccedcbda..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_application_insights_management_client.py +++ /dev/null @@ -1,131 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import Operations, WorkbooksOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar workbooks: WorkbooksOperations operations - :vartype workbooks: - azure.mgmt.applicationinsights.v2018_06_17_preview.operations.WorkbooksOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.applicationinsights.v2018_06_17_preview.operations.Operations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2018-06-17-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_configuration.py deleted file mode 100644 index cd8c17b2f848..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2018-06-17-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2018-06-17-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_application_insights_management_client.py deleted file mode 100644 index 4f4cdd71c32e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_application_insights_management_client.py +++ /dev/null @@ -1,136 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import Operations, WorkbooksOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar workbooks: WorkbooksOperations operations - :vartype workbooks: - azure.mgmt.applicationinsights.v2018_06_17_preview.aio.operations.WorkbooksOperations - :ivar operations: Operations operations - :vartype operations: - azure.mgmt.applicationinsights.v2018_06_17_preview.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: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2018-06-17-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_configuration.py deleted file mode 100644 index 1e97c9556149..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2018-06-17-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2018-06-17-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/__init__.py deleted file mode 100644 index aed9fd104c66..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._workbooks_operations import WorkbooksOperations # type: ignore -from ._operations import Operations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbooksOperations", - "Operations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_operations.py deleted file mode 100644 index f7c4506bbd97..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2018_06_17_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: - """Lists all of the available insights REST API operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_workbooks_operations.py deleted file mode 100644 index 85fda2eac8d8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/aio/operations/_workbooks_operations.py +++ /dev/null @@ -1,585 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._workbooks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2018_06_17_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - source_id: str, - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.CategoryType - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - source_id=source_id, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Workbook: - """Get a single workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Delete a workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_properties: _models.Workbook, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_properties: Union[_models.Workbook, IO[bytes]], - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_properties: Properties that need to be specified to create a new workbook. Is - either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - or IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "Workbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.WorkbookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.WorkbookUpdateParameters or - IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if workbook_update_parameters else None - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if workbook_update_parameters else None - _json = None - _content = None - if isinstance(workbook_update_parameters, (IOBase, bytes)): - _content = workbook_update_parameters - else: - if workbook_update_parameters is not None: - _json = self._serialize.body(workbook_update_parameters, "WorkbookUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/__init__.py deleted file mode 100644 index fdcf4a98ff35..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/__init__.py +++ /dev/null @@ -1,52 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ErrorFieldContract, - ErrorResponse, - Operation, - OperationDisplay, - OperationListResult, - Resource, - Workbook, - WorkbookError, - WorkbookUpdateParameters, - WorkbooksListResult, -) - -from ._application_insights_management_client_enums import ( # type: ignore - CategoryType, - SharedTypeKind, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ErrorFieldContract", - "ErrorResponse", - "Operation", - "OperationDisplay", - "OperationListResult", - "Resource", - "Workbook", - "WorkbookError", - "WorkbookUpdateParameters", - "WorkbooksListResult", - "CategoryType", - "SharedTypeKind", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_application_insights_management_client_enums.py deleted file mode 100644 index c1110cd17a40..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_application_insights_management_client_enums.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 enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """CategoryType.""" - - WORKBOOK = "workbook" - TSG = "TSG" - PERFORMANCE = "performance" - RETENTION = "retention" - - -class SharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of workbook. Choices are user and shared.""" - - USER = "user" - SHARED = "shared" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_models_py3.py deleted file mode 100644 index f2ff79ebaa75..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_models_py3.py +++ /dev/null @@ -1,484 +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, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class ErrorFieldContract(_serialization.Model): - """Error Field contract. - - :ivar code: Property level error code. - :vartype code: str - :ivar message: Human-readable representation of property-level error. - :vartype message: str - :ivar target: Property name. - :vartype target: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__( - self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword code: Property level error code. - :paramtype code: str - :keyword message: Human-readable representation of property-level error. - :paramtype message: str - :keyword target: Property name. - :paramtype target: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - - -class ErrorResponse(_serialization.Model): - """Error response indicates Insights service is not able to process the incoming request. The - reason is provided in the error message. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: Error code. - :paramtype code: str - :keyword message: Error message indicating why the operation failed. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class Operation(_serialization.Model): - """CDN REST API operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.applicationinsights.v2018_06_17_preview.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: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = name - self.display = display - - -class OperationDisplay(_serialization.Model): - """The object that represents the operation. - - :ivar provider: Service provider: Microsoft.Cdn. - :vartype provider: str - :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. - :vartype resource: str - :ivar operation: Operation type: Read, write, delete, etc. - :vartype operation: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: Service provider: Microsoft.Cdn. - :paramtype provider: str - :keyword resource: Resource on which the operation is performed: Profile, endpoint, etc. - :paramtype resource: str - :keyword operation: Operation type: Read, write, delete, etc. - :paramtype operation: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - - -class OperationListResult(_serialization.Model): - """Result of the request to list CDN operations. It contains a list of operations and a URL link - to get the next set of results. - - :ivar value: List of CDN operations supported by the CDN resource provider. - :vartype value: list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Operation] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of CDN operations supported by the CDN resource provider. - :paramtype value: list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Operation] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class Resource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. This is GUID value. The display name should be assigned within - properties field. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__( - self, - *, - location: str, - kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, - tags: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :paramtype kind: str or - ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.kind = kind - self.location = location - self.tags = tags - - -class Workbook(Resource): - """An Application Insights workbook definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. This is GUID value. The display name should be assigned within - properties field. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar display_name: The user-defined name (display name) of the workbook. - :vartype display_name: str - :ivar serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :vartype serialized_data: str - :ivar time_modified: Date and time in UTC of the last modification that was made to this - workbook definition. - :vartype time_modified: str - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar version: Workbook version. - :vartype version: str - :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :vartype tags_properties_tags: list[str] - :ivar user_id: Unique user id of the specific user that owns this workbook. - :vartype user_id: str - :ivar source_id: ResourceId for a source resource. - :vartype source_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "time_modified": {"readonly": True}, - "user_id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "time_modified": {"key": "properties.timeModified", "type": "str"}, - "category": {"key": "properties.category", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - "user_id": {"key": "properties.userId", "type": "str"}, - "source_id": {"key": "properties.sourceId", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, - tags: Optional[dict[str, str]] = None, - display_name: Optional[str] = None, - serialized_data: Optional[str] = None, - category: Optional[str] = None, - version: Optional[str] = None, - tags_properties_tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :paramtype kind: str or - ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword display_name: The user-defined name (display name) of the workbook. - :paramtype display_name: str - :keyword serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :paramtype serialized_data: str - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword version: Workbook version. - :paramtype version: str - :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :paramtype tags_properties_tags: list[str] - :keyword source_id: ResourceId for a source resource. - :paramtype source_id: str - """ - super().__init__(kind=kind, location=location, tags=tags, **kwargs) - self.display_name = display_name - self.serialized_data = serialized_data - self.time_modified: Optional[str] = None - self.category = category - self.version = version - self.tags_properties_tags = tags_properties_tags - self.user_id: Optional[str] = None - self.source_id = source_id - - -class WorkbookError(_serialization.Model): - """Error message body that will indicate why the operation failed. - - :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :vartype code: str - :ivar message: Human-readable representation of the error. - :vartype message: str - :ivar details: The list of invalid fields send in request, in case of validation error. - :vartype details: - list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.ErrorFieldContract] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[ErrorFieldContract]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - details: Optional[list["_models.ErrorFieldContract"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :paramtype code: str - :keyword message: Human-readable representation of the error. - :paramtype message: str - :keyword details: The list of invalid fields send in request, in case of validation error. - :paramtype details: - list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.ErrorFieldContract] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.details = details - - -class WorkbooksListResult(_serialization.Model): - """Workbook list result. - - :ivar value: An array of workbooks. - :vartype value: list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Workbook]"}, - } - - def __init__(self, *, value: Optional[list["_models.Workbook"]] = None, **kwargs: Any) -> None: - """ - :keyword value: An array of workbooks. - :paramtype value: list[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook] - """ - super().__init__(**kwargs) - self.value = value - - -class WorkbookUpdateParameters(_serialization.Model): - """The parameters that can be provided when updating workbook properties properties. - - :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar display_name: The user-defined name (display name) of the workbook. - :vartype display_name: str - :ivar serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :vartype serialized_data: str - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :vartype tags_properties_tags: list[str] - """ - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "category": {"key": "properties.category", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - } - - def __init__( - self, - *, - kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, - tags: Optional[dict[str, str]] = None, - display_name: Optional[str] = None, - serialized_data: Optional[str] = None, - category: Optional[str] = None, - tags_properties_tags: Optional[list[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :paramtype kind: str or - ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.SharedTypeKind - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword display_name: The user-defined name (display name) of the workbook. - :paramtype display_name: str - :keyword serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :paramtype serialized_data: str - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :paramtype tags_properties_tags: list[str] - """ - super().__init__(**kwargs) - self.kind = kind - self.tags = tags - self.display_name = display_name - self.serialized_data = serialized_data - self.category = category - self.tags_properties_tags = tags_properties_tags diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/__init__.py deleted file mode 100644 index aed9fd104c66..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._workbooks_operations import WorkbooksOperations # type: ignore -from ._operations import Operations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbooksOperations", - "Operations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_operations.py deleted file mode 100644 index b278f1bbe7b9..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_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-06-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/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.applicationinsights.v2018_06_17_preview.ApplicationInsightsManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: - """Lists all of the available insights REST API operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_workbooks_operations.py deleted file mode 100644 index a2b3b984f4bb..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/operations/_workbooks_operations.py +++ /dev/null @@ -1,766 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - category: Union[str, _models.CategoryType], - source_id: str, - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks", - ) - 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["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2018-06-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2018-06-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, resource_name: str, subscription_id: str, *, source_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", "2018-06-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, resource_name: str, subscription_id: str, *, source_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", "2018-06-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class WorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2018_06_17_preview.ApplicationInsightsManagementClient`'s - :attr:`workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - source_id: str, - tags: Optional[List[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.CategoryType - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - source_id=source_id, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.Workbook: - """Get a single workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Delete a workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_properties: _models.Workbook, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_properties: Union[_models.Workbook, IO[bytes]], - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_properties: Properties that need to be specified to create a new workbook. Is - either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - or IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "Workbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.WorkbookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - source_id: str, - workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all related workbooks. Required. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.WorkbookUpdateParameters or - IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2018_06_17_preview.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if workbook_update_parameters else None - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if workbook_update_parameters else None - _json = None - _content = None - if isinstance(workbook_update_parameters, (IOBase, bytes)): - _content = workbook_update_parameters - else: - if workbook_update_parameters is not None: - _json = self._serialize.body(workbook_update_parameters, "WorkbookUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2018_06_17_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_application_insights_management_client.py deleted file mode 100644 index 821868f277b0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_application_insights_management_client.py +++ /dev/null @@ -1,130 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import WorkbookTemplatesOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar workbook_templates: WorkbookTemplatesOperations operations - :vartype workbook_templates: - azure.mgmt.applicationinsights.v2019_10_17_preview.operations.WorkbookTemplatesOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2019-10-17-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.workbook_templates = WorkbookTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_configuration.py deleted file mode 100644 index 9b30c6905066..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2019-10-17-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2019-10-17-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_application_insights_management_client.py deleted file mode 100644 index 49390908778f..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_application_insights_management_client.py +++ /dev/null @@ -1,134 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import WorkbookTemplatesOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar workbook_templates: WorkbookTemplatesOperations operations - :vartype workbook_templates: - azure.mgmt.applicationinsights.v2019_10_17_preview.aio.operations.WorkbookTemplatesOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2019-10-17-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.workbook_templates = WorkbookTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_configuration.py deleted file mode 100644 index 13fd78481100..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2019-10-17-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2019-10-17-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/__init__.py deleted file mode 100644 index aa730bc20e57..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._workbook_templates_operations import WorkbookTemplatesOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbookTemplatesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_workbook_templates_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_workbook_templates_operations.py deleted file mode 100644 index 48b6b3da21b9..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/aio/operations/_workbook_templates_operations.py +++ /dev/null @@ -1,548 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._workbook_templates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class WorkbookTemplatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2019_10_17_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`workbook_templates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.WorkbookTemplate"]: - """Get all Workbook templates defined within a specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WorkbookTemplate or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbookTemplatesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.WorkbookTemplate: - """Get a single workbook template by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Delete a workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: _models.WorkbookTemplate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Required. - :type workbook_template_properties: - ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Required. - :type workbook_template_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: Union[_models.WorkbookTemplate, IO[bytes]], - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Is either a WorkbookTemplate type or a IO[bytes] type. Required. - :type workbook_template_properties: - ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate or IO[bytes] - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_template_properties, (IOBase, bytes)): - _content = workbook_template_properties - else: - _json = self._serialize.body(workbook_template_properties, "WorkbookTemplate") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[_models.WorkbookTemplateUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Default value is None. - :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Default value is None. - :type workbook_template_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[ - Union[_models.WorkbookTemplateUpdateParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Is either a WorkbookTemplateUpdateParameters type or a IO[bytes] type. - Default value is None. - :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateUpdateParameters or - IO[bytes] - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if workbook_template_update_parameters else None - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if workbook_template_update_parameters else None - _json = None - _content = None - if isinstance(workbook_template_update_parameters, (IOBase, bytes)): - _content = workbook_template_update_parameters - else: - if workbook_template_update_parameters is not None: - _json = self._serialize.body(workbook_template_update_parameters, "WorkbookTemplateUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/__init__.py deleted file mode 100644 index 9624ccdad420..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ErrorFieldContract, - WorkbookError, - WorkbookTemplate, - WorkbookTemplateGallery, - WorkbookTemplateLocalizedGallery, - WorkbookTemplateResource, - WorkbookTemplateUpdateParameters, - WorkbookTemplatesListResult, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ErrorFieldContract", - "WorkbookError", - "WorkbookTemplate", - "WorkbookTemplateGallery", - "WorkbookTemplateLocalizedGallery", - "WorkbookTemplateResource", - "WorkbookTemplateUpdateParameters", - "WorkbookTemplatesListResult", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_models_py3.py deleted file mode 100644 index 8a805a1353f6..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_models_py3.py +++ /dev/null @@ -1,412 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from collections.abc import MutableMapping -from typing import Any, Optional, TYPE_CHECKING - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class ErrorFieldContract(_serialization.Model): - """Error Field contract. - - :ivar code: Property level error code. - :vartype code: str - :ivar message: Human-readable representation of property-level error. - :vartype message: str - :ivar target: Property name. - :vartype target: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__( - self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword code: Property level error code. - :paramtype code: str - :keyword message: Human-readable representation of property-level error. - :paramtype message: str - :keyword target: Property name. - :paramtype target: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - - -class WorkbookError(_serialization.Model): - """Error message body that will indicate why the operation failed. - - :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :vartype code: str - :ivar message: Human-readable representation of the error. - :vartype message: str - :ivar details: The list of invalid fields send in request, in case of validation error. - :vartype details: - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.ErrorFieldContract] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[ErrorFieldContract]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - details: Optional[list["_models.ErrorFieldContract"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :paramtype code: str - :keyword message: Human-readable representation of the error. - :paramtype message: str - :keyword details: The list of invalid fields send in request, in case of validation error. - :paramtype details: - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.ErrorFieldContract] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.details = details - - -class WorkbookTemplateResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class WorkbookTemplate(WorkbookTemplateResource): - """An Application Insights workbook template definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :vartype priority: int - :ivar author: Information about the author of the workbook template. - :vartype author: str - :ivar template_data: Valid JSON object containing workbook template payload. - :vartype template_data: JSON - :ivar galleries: Workbook galleries supported by the template. - :vartype galleries: - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] - :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages - supported by the Azure portal. - :vartype localized: dict[str, - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateLocalizedGallery]] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "priority": {"key": "properties.priority", "type": "int"}, - "author": {"key": "properties.author", "type": "str"}, - "template_data": {"key": "properties.templateData", "type": "object"}, - "galleries": {"key": "properties.galleries", "type": "[WorkbookTemplateGallery]"}, - "localized": {"key": "properties.localized", "type": "{[WorkbookTemplateLocalizedGallery]}"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - priority: Optional[int] = None, - author: Optional[str] = None, - template_data: Optional[JSON] = None, - galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, - localized: Optional[dict[str, list["_models.WorkbookTemplateLocalizedGallery"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :paramtype priority: int - :keyword author: Information about the author of the workbook template. - :paramtype author: str - :keyword template_data: Valid JSON object containing workbook template payload. - :paramtype template_data: JSON - :keyword galleries: Workbook galleries supported by the template. - :paramtype galleries: - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] - :keyword localized: Key value pair of localized gallery. Each key is the locale code of - languages supported by the Azure portal. - :paramtype localized: dict[str, - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateLocalizedGallery]] - """ - super().__init__(location=location, tags=tags, **kwargs) - self.priority = priority - self.author = author - self.template_data = template_data - self.galleries = galleries - self.localized = localized - - -class WorkbookTemplateGallery(_serialization.Model): - """Gallery information for a workbook template. - - :ivar name: Name of the workbook template in the gallery. - :vartype name: str - :ivar category: Category for the gallery. - :vartype category: str - :ivar type: Type of workbook supported by the workbook template. - :vartype type: str - :ivar order: Order of the template within the gallery. - :vartype order: int - :ivar resource_type: Azure resource type supported by the gallery. - :vartype resource_type: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "order": {"key": "order", "type": "int"}, - "resource_type": {"key": "resourceType", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - category: Optional[str] = None, - type: Optional[str] = None, - order: Optional[int] = None, - resource_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the workbook template in the gallery. - :paramtype name: str - :keyword category: Category for the gallery. - :paramtype category: str - :keyword type: Type of workbook supported by the workbook template. - :paramtype type: str - :keyword order: Order of the template within the gallery. - :paramtype order: int - :keyword resource_type: Azure resource type supported by the gallery. - :paramtype resource_type: str - """ - super().__init__(**kwargs) - self.name = name - self.category = category - self.type = type - self.order = order - self.resource_type = resource_type - - -class WorkbookTemplateLocalizedGallery(_serialization.Model): - """Localized template data and gallery information. - - :ivar template_data: Valid JSON object containing workbook template payload. - :vartype template_data: JSON - :ivar galleries: Workbook galleries supported by the template. - :vartype galleries: - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] - """ - - _attribute_map = { - "template_data": {"key": "templateData", "type": "object"}, - "galleries": {"key": "galleries", "type": "[WorkbookTemplateGallery]"}, - } - - def __init__( - self, - *, - template_data: Optional[JSON] = None, - galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword template_data: Valid JSON object containing workbook template payload. - :paramtype template_data: JSON - :keyword galleries: Workbook galleries supported by the template. - :paramtype galleries: - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] - """ - super().__init__(**kwargs) - self.template_data = template_data - self.galleries = galleries - - -class WorkbookTemplatesListResult(_serialization.Model): - """WorkbookTemplate list result. - - :ivar value: An array of workbook templates. - :vartype value: - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[WorkbookTemplate]"}, - } - - def __init__(self, *, value: Optional[list["_models.WorkbookTemplate"]] = None, **kwargs: Any) -> None: - """ - :keyword value: An array of workbook templates. - :paramtype value: - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate] - """ - super().__init__(**kwargs) - self.value = value - - -class WorkbookTemplateUpdateParameters(_serialization.Model): - """The parameters that can be provided when updating workbook template. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :vartype priority: int - :ivar author: Information about the author of the workbook template. - :vartype author: str - :ivar template_data: Valid JSON object containing workbook template payload. - :vartype template_data: JSON - :ivar galleries: Workbook galleries supported by the template. - :vartype galleries: - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] - :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages - supported by the Azure portal. - :vartype localized: dict[str, - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateLocalizedGallery]] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "priority": {"key": "properties.priority", "type": "int"}, - "author": {"key": "properties.author", "type": "str"}, - "template_data": {"key": "properties.templateData", "type": "object"}, - "galleries": {"key": "properties.galleries", "type": "[WorkbookTemplateGallery]"}, - "localized": {"key": "properties.localized", "type": "{[WorkbookTemplateLocalizedGallery]}"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - priority: Optional[int] = None, - author: Optional[str] = None, - template_data: Optional[JSON] = None, - galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, - localized: Optional[dict[str, list["_models.WorkbookTemplateLocalizedGallery"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :paramtype priority: int - :keyword author: Information about the author of the workbook template. - :paramtype author: str - :keyword template_data: Valid JSON object containing workbook template payload. - :paramtype template_data: JSON - :keyword galleries: Workbook galleries supported by the template. - :paramtype galleries: - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateGallery] - :keyword localized: Key value pair of localized gallery. Each key is the locale code of - languages supported by the Azure portal. - :paramtype localized: dict[str, - list[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateLocalizedGallery]] - """ - super().__init__(**kwargs) - self.tags = tags - self.priority = priority - self.author = author - self.template_data = template_data - self.galleries = galleries - self.localized = localized diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/__init__.py deleted file mode 100644 index aa730bc20e57..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._workbook_templates_operations import WorkbookTemplatesOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbookTemplatesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_workbook_templates_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_workbook_templates_operations.py deleted file mode 100644 index 691e1f5bd41b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/operations/_workbook_templates_operations.py +++ /dev/null @@ -1,709 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -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_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooktemplates", - ) - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooktemplates/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2019-10-17-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooktemplates/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, 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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooktemplates/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, 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", "2019-10-17-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooktemplates/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class WorkbookTemplatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2019_10_17_preview.ApplicationInsightsManagementClient`'s - :attr:`workbook_templates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.WorkbookTemplate"]: - """Get all Workbook templates defined within a specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WorkbookTemplate or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbookTemplatesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.WorkbookTemplate: - """Get a single workbook template by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Delete a workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: _models.WorkbookTemplate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Required. - :type workbook_template_properties: - ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Required. - :type workbook_template_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: Union[_models.WorkbookTemplate, IO[bytes]], - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Is either a WorkbookTemplate type or a IO[bytes] type. Required. - :type workbook_template_properties: - ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate or IO[bytes] - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_template_properties, (IOBase, bytes)): - _content = workbook_template_properties - else: - _json = self._serialize.body(workbook_template_properties, "WorkbookTemplate") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[_models.WorkbookTemplateUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Default value is None. - :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Default value is None. - :type workbook_template_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[ - Union[_models.WorkbookTemplateUpdateParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Is either a WorkbookTemplateUpdateParameters type or a IO[bytes] type. - Default value is None. - :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplateUpdateParameters or - IO[bytes] - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2019_10_17_preview.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if workbook_template_update_parameters else None - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if workbook_template_update_parameters else None - _json = None - _content = None - if isinstance(workbook_template_update_parameters, (IOBase, bytes)): - _content = workbook_template_update_parameters - else: - if workbook_template_update_parameters is not None: - _json = self._serialize.body(workbook_template_update_parameters, "WorkbookTemplateUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2019_10_17_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_application_insights_management_client.py deleted file mode 100644 index fa4e499c82e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_application_insights_management_client.py +++ /dev/null @@ -1,127 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import ComponentsOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar components: ComponentsOperations operations - :vartype components: azure.mgmt.applicationinsights.v2020_02_02.operations.ComponentsOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-02-02". 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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_application_insights_management_client.py deleted file mode 100644 index 9e392c3bdb27..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_application_insights_management_client.py +++ /dev/null @@ -1,132 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import ComponentsOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar components: ComponentsOperations operations - :vartype components: - azure.mgmt.applicationinsights.v2020_02_02.aio.operations.ComponentsOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-02-02". 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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_configuration.py deleted file mode 100644 index a9d5aa5fbc2c..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-02-02". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2020-02-02") - - 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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/__init__.py deleted file mode 100644 index ab50c30fbaac..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._components_operations import ComponentsOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ComponentsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_components_operations.py deleted file mode 100644 index 7cc8daae5d0d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_components_operations.py +++ /dev/null @@ -1,859 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._components_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_purge_status_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_purge_request, - build_update_tags_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_02_02.aio.ApplicationInsightsManagementClient`'s - :attr:`components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of all Application Insights components within a subscription. - - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of Application Insights components within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Deletes an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Returns an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: _models.ApplicationInsightsComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. - Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent or IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(insight_properties, (IOBase, bytes)): - _content = insight_properties - else: - _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02.models.TagsResource or - IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(component_tags, (IOBase, bytes)): - _content = component_tags - else: - _json = self._serialize.body(component_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: _models.ComponentPurgeBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - Note: this operation is intended for Classic resources, for workspace-based Application - Insights resource please run purge operation (directly on the - workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , - scoped to specific resource id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - Note: this operation is intended for Classic resources, for workspace-based Application - Insights resource please run purge operation (directly on the - workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , - scoped to specific resource id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: Union[_models.ComponentPurgeBody, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - Note: this operation is intended for Classic resources, for workspace-based Application - Insights resource please run purge operation (directly on the - workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , - scoped to specific resource id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBody or IO[bytes] - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "ComponentPurgeBody") - - _request = build_purge_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_purge_status( - self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any - ) -> _models.ComponentPurgeStatusResponse: - """Get status for an ongoing purge operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param purge_id: In a purge status request, this is the Id of the operation the status of which - is returned. Required. - :type purge_id: str - :return: ComponentPurgeStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeStatusResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) - - _request = build_get_purge_status_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - purge_id=purge_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/__init__.py deleted file mode 100644 index 3970e25b69c3..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/__init__.py +++ /dev/null @@ -1,62 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ApplicationInsightsComponent, - ApplicationInsightsComponentListResult, - ComponentPurgeBody, - ComponentPurgeBodyFilters, - ComponentPurgeResponse, - ComponentPurgeStatusResponse, - ComponentsResource, - ErrorResponseComponents, - ErrorResponseComponentsError, - PrivateLinkScopedResource, - TagsResource, -) - -from ._application_insights_management_client_enums import ( # type: ignore - ApplicationType, - FlowType, - IngestionMode, - PublicNetworkAccessType, - PurgeState, - RequestSource, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsComponent", - "ApplicationInsightsComponentListResult", - "ComponentPurgeBody", - "ComponentPurgeBodyFilters", - "ComponentPurgeResponse", - "ComponentPurgeStatusResponse", - "ComponentsResource", - "ErrorResponseComponents", - "ErrorResponseComponentsError", - "PrivateLinkScopedResource", - "TagsResource", - "ApplicationType", - "FlowType", - "IngestionMode", - "PublicNetworkAccessType", - "PurgeState", - "RequestSource", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_application_insights_management_client_enums.py deleted file mode 100644 index 8b3d890ab9d8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_application_insights_management_client_enums.py +++ /dev/null @@ -1,60 +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 ApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application being monitored.""" - - WEB = "web" - OTHER = "other" - - -class FlowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Used by the Application Insights system to determine what kind of flow this component was - created by. This is to be set to 'Bluefield' when creating/updating a component via the REST - API. - """ - - BLUEFIELD = "Bluefield" - - -class IngestionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates the flow of the ingestion.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS = "ApplicationInsightsWithDiagnosticSettings" - LOG_ANALYTICS = "LogAnalytics" - - -class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The network access type for operating on the Application Insights Component. By default it is - Enabled. - """ - - ENABLED = "Enabled" - """Enables connectivity to Application Insights through public DNS.""" - DISABLED = "Disabled" - """Disables public connectivity to Application Insights through public DNS.""" - - -class PurgeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the operation represented by the requested Id.""" - - PENDING = "pending" - COMPLETED = "completed" - - -class RequestSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Describes what tool created this Application Insights component. Customers using this API - should set this to the default 'rest'. - """ - - REST = "rest" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_models_py3.py deleted file mode 100644 index 8c6a05e7ad8a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_models_py3.py +++ /dev/null @@ -1,615 +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. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class ComponentsResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class ApplicationInsightsComponent(ComponentsResource): - """An Application Insights component definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: The kind of application that this component refers to, used to customize UI. This - value is a freeform string, values should typically be one of the following: web, ios, other, - store, java, phone. Required. - :vartype kind: str - :ivar etag: Resource etag. - :vartype etag: str - :ivar application_id: The unique ID of your application. This field mirrors the 'Name' field - and cannot be changed. - :vartype application_id: str - :ivar app_id: Application Insights Unique ID for your Application. - :vartype app_id: str - :ivar name_properties_name: Application name. - :vartype name_properties_name: str - :ivar application_type: Type of application being monitored. Known values are: "web" and - "other". - :vartype application_type: str or - ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationType - :ivar flow_type: Used by the Application Insights system to determine what kind of flow this - component was created by. This is to be set to 'Bluefield' when creating/updating a component - via the REST API. "Bluefield" - :vartype flow_type: str or ~azure.mgmt.applicationinsights.v2020_02_02.models.FlowType - :ivar request_source: Describes what tool created this Application Insights component. - Customers using this API should set this to the default 'rest'. "rest" - :vartype request_source: str or - ~azure.mgmt.applicationinsights.v2020_02_02.models.RequestSource - :ivar instrumentation_key: Application Insights Instrumentation key. A read-only value that - applications can use to identify the destination for all telemetry sent to Azure Application - Insights. This value will be supplied upon construction of each new Application Insights - component. - :vartype instrumentation_key: str - :ivar creation_date: Creation Date for the Application Insights component, in ISO 8601 format. - :vartype creation_date: ~datetime.datetime - :ivar tenant_id: Azure Tenant Id. - :vartype tenant_id: str - :ivar hockey_app_id: The unique application ID created when a new application is added to - HockeyApp, used for communications with HockeyApp. - :vartype hockey_app_id: str - :ivar hockey_app_token: Token used to authenticate communications with between Application - Insights and HockeyApp. - :vartype hockey_app_token: str - :ivar provisioning_state: Current state of this component: whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. - :vartype provisioning_state: str - :ivar sampling_percentage: Percentage of the data produced by the application being monitored - that is being sampled for Application Insights telemetry. - :vartype sampling_percentage: float - :ivar connection_string: Application Insights component connection string. - :vartype connection_string: str - :ivar retention_in_days: Retention period in days. - :vartype retention_in_days: int - :ivar disable_ip_masking: Disable IP masking. - :vartype disable_ip_masking: bool - :ivar immediate_purge_data_on30_days: Purge data immediately after 30 days. - :vartype immediate_purge_data_on30_days: bool - :ivar workspace_resource_id: Resource Id of the log analytics workspace which the data will be - ingested to. This property is required to create an application with this API version. - Applications from older versions will not have this property. - :vartype workspace_resource_id: str - :ivar la_migration_date: The date which the component got migrated to LA, in ISO 8601 format. - :vartype la_migration_date: ~datetime.datetime - :ivar private_link_scoped_resources: List of linked private link scope resources. - :vartype private_link_scoped_resources: - list[~azure.mgmt.applicationinsights.v2020_02_02.models.PrivateLinkScopedResource] - :ivar public_network_access_for_ingestion: The network access type for accessing Application - Insights ingestion. Known values are: "Enabled" and "Disabled". - :vartype public_network_access_for_ingestion: str or - ~azure.mgmt.applicationinsights.v2020_02_02.models.PublicNetworkAccessType - :ivar public_network_access_for_query: The network access type for accessing Application - Insights query. Known values are: "Enabled" and "Disabled". - :vartype public_network_access_for_query: str or - ~azure.mgmt.applicationinsights.v2020_02_02.models.PublicNetworkAccessType - :ivar ingestion_mode: Indicates the flow of the ingestion. Known values are: - "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". - :vartype ingestion_mode: str or - ~azure.mgmt.applicationinsights.v2020_02_02.models.IngestionMode - :ivar disable_local_auth: Disable Non-AAD based Auth. - :vartype disable_local_auth: bool - :ivar force_customer_storage_for_profiler: Force users to create their own storage account for - profiler and debugger. - :vartype force_customer_storage_for_profiler: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "kind": {"required": True}, - "application_id": {"readonly": True}, - "app_id": {"readonly": True}, - "name_properties_name": {"readonly": True}, - "instrumentation_key": {"readonly": True}, - "creation_date": {"readonly": True}, - "tenant_id": {"readonly": True}, - "hockey_app_token": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "connection_string": {"readonly": True}, - "la_migration_date": {"readonly": True}, - "private_link_scoped_resources": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "application_id": {"key": "properties.ApplicationId", "type": "str"}, - "app_id": {"key": "properties.AppId", "type": "str"}, - "name_properties_name": {"key": "properties.Name", "type": "str"}, - "application_type": {"key": "properties.Application_Type", "type": "str"}, - "flow_type": {"key": "properties.Flow_Type", "type": "str"}, - "request_source": {"key": "properties.Request_Source", "type": "str"}, - "instrumentation_key": {"key": "properties.InstrumentationKey", "type": "str"}, - "creation_date": {"key": "properties.CreationDate", "type": "iso-8601"}, - "tenant_id": {"key": "properties.TenantId", "type": "str"}, - "hockey_app_id": {"key": "properties.HockeyAppId", "type": "str"}, - "hockey_app_token": {"key": "properties.HockeyAppToken", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "sampling_percentage": {"key": "properties.SamplingPercentage", "type": "float"}, - "connection_string": {"key": "properties.ConnectionString", "type": "str"}, - "retention_in_days": {"key": "properties.RetentionInDays", "type": "int"}, - "disable_ip_masking": {"key": "properties.DisableIpMasking", "type": "bool"}, - "immediate_purge_data_on30_days": {"key": "properties.ImmediatePurgeDataOn30Days", "type": "bool"}, - "workspace_resource_id": {"key": "properties.WorkspaceResourceId", "type": "str"}, - "la_migration_date": {"key": "properties.LaMigrationDate", "type": "iso-8601"}, - "private_link_scoped_resources": { - "key": "properties.PrivateLinkScopedResources", - "type": "[PrivateLinkScopedResource]", - }, - "public_network_access_for_ingestion": {"key": "properties.publicNetworkAccessForIngestion", "type": "str"}, - "public_network_access_for_query": {"key": "properties.publicNetworkAccessForQuery", "type": "str"}, - "ingestion_mode": {"key": "properties.IngestionMode", "type": "str"}, - "disable_local_auth": {"key": "properties.DisableLocalAuth", "type": "bool"}, - "force_customer_storage_for_profiler": {"key": "properties.ForceCustomerStorageForProfiler", "type": "bool"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - kind: str, - tags: Optional[dict[str, str]] = None, - etag: Optional[str] = None, - application_type: Union[str, "_models.ApplicationType"] = "web", - flow_type: Union[str, "_models.FlowType"] = "Bluefield", - request_source: Union[str, "_models.RequestSource"] = "rest", - hockey_app_id: Optional[str] = None, - sampling_percentage: Optional[float] = None, - retention_in_days: Optional[int] = None, - disable_ip_masking: Optional[bool] = None, - immediate_purge_data_on30_days: Optional[bool] = None, - workspace_resource_id: Optional[str] = None, - public_network_access_for_ingestion: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", - public_network_access_for_query: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", - ingestion_mode: Union[str, "_models.IngestionMode"] = "LogAnalytics", - disable_local_auth: Optional[bool] = None, - force_customer_storage_for_profiler: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword kind: The kind of application that this component refers to, used to customize UI. - This value is a freeform string, values should typically be one of the following: web, ios, - other, store, java, phone. Required. - :paramtype kind: str - :keyword etag: Resource etag. - :paramtype etag: str - :keyword application_type: Type of application being monitored. Known values are: "web" and - "other". - :paramtype application_type: str or - ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationType - :keyword flow_type: Used by the Application Insights system to determine what kind of flow this - component was created by. This is to be set to 'Bluefield' when creating/updating a component - via the REST API. "Bluefield" - :paramtype flow_type: str or ~azure.mgmt.applicationinsights.v2020_02_02.models.FlowType - :keyword request_source: Describes what tool created this Application Insights component. - Customers using this API should set this to the default 'rest'. "rest" - :paramtype request_source: str or - ~azure.mgmt.applicationinsights.v2020_02_02.models.RequestSource - :keyword hockey_app_id: The unique application ID created when a new application is added to - HockeyApp, used for communications with HockeyApp. - :paramtype hockey_app_id: str - :keyword sampling_percentage: Percentage of the data produced by the application being - monitored that is being sampled for Application Insights telemetry. - :paramtype sampling_percentage: float - :keyword retention_in_days: Retention period in days. - :paramtype retention_in_days: int - :keyword disable_ip_masking: Disable IP masking. - :paramtype disable_ip_masking: bool - :keyword immediate_purge_data_on30_days: Purge data immediately after 30 days. - :paramtype immediate_purge_data_on30_days: bool - :keyword workspace_resource_id: Resource Id of the log analytics workspace which the data will - be ingested to. This property is required to create an application with this API version. - Applications from older versions will not have this property. - :paramtype workspace_resource_id: str - :keyword public_network_access_for_ingestion: The network access type for accessing Application - Insights ingestion. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access_for_ingestion: str or - ~azure.mgmt.applicationinsights.v2020_02_02.models.PublicNetworkAccessType - :keyword public_network_access_for_query: The network access type for accessing Application - Insights query. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access_for_query: str or - ~azure.mgmt.applicationinsights.v2020_02_02.models.PublicNetworkAccessType - :keyword ingestion_mode: Indicates the flow of the ingestion. Known values are: - "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". - :paramtype ingestion_mode: str or - ~azure.mgmt.applicationinsights.v2020_02_02.models.IngestionMode - :keyword disable_local_auth: Disable Non-AAD based Auth. - :paramtype disable_local_auth: bool - :keyword force_customer_storage_for_profiler: Force users to create their own storage account - for profiler and debugger. - :paramtype force_customer_storage_for_profiler: bool - """ - super().__init__(location=location, tags=tags, **kwargs) - self.kind = kind - self.etag = etag - self.application_id: Optional[str] = None - self.app_id: Optional[str] = None - self.name_properties_name: Optional[str] = None - self.application_type = application_type - self.flow_type = flow_type - self.request_source = request_source - self.instrumentation_key: Optional[str] = None - self.creation_date: Optional[datetime.datetime] = None - self.tenant_id: Optional[str] = None - self.hockey_app_id = hockey_app_id - self.hockey_app_token: Optional[str] = None - self.provisioning_state: Optional[str] = None - self.sampling_percentage = sampling_percentage - self.connection_string: Optional[str] = None - self.retention_in_days = retention_in_days - self.disable_ip_masking = disable_ip_masking - self.immediate_purge_data_on30_days = immediate_purge_data_on30_days - self.workspace_resource_id = workspace_resource_id - self.la_migration_date: Optional[datetime.datetime] = None - self.private_link_scoped_resources: Optional[list["_models.PrivateLinkScopedResource"]] = None - self.public_network_access_for_ingestion = public_network_access_for_ingestion - self.public_network_access_for_query = public_network_access_for_query - self.ingestion_mode = ingestion_mode - self.disable_local_auth = disable_local_auth - self.force_customer_storage_for_profiler = force_customer_storage_for_profiler - - -class ApplicationInsightsComponentListResult(_serialization.Model): - """Describes the list of Application Insights Resources. - - All required parameters must be populated in order to send to server. - - :ivar value: List of Application Insights component definitions. Required. - :vartype value: - list[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] - :ivar next_link: The URI to get the next set of Application Insights component definitions if - too many components where returned in the result set. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationInsightsComponent]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.ApplicationInsightsComponent"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of Application Insights component definitions. Required. - :paramtype value: - list[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] - :keyword next_link: The URI to get the next set of Application Insights component definitions - if too many components where returned in the result set. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ComponentPurgeBody(_serialization.Model): - """Describes the body of a purge request for an App Insights component. - - All required parameters must be populated in order to send to server. - - :ivar table: Table from which to purge data. Required. - :vartype table: str - :ivar filters: The set of columns and filters (queries) to run over them to purge the resulting - data. Required. - :vartype filters: - list[~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBodyFilters] - """ - - _validation = { - "table": {"required": True}, - "filters": {"required": True}, - } - - _attribute_map = { - "table": {"key": "table", "type": "str"}, - "filters": {"key": "filters", "type": "[ComponentPurgeBodyFilters]"}, - } - - def __init__(self, *, table: str, filters: list["_models.ComponentPurgeBodyFilters"], **kwargs: Any) -> None: - """ - :keyword table: Table from which to purge data. Required. - :paramtype table: str - :keyword filters: The set of columns and filters (queries) to run over them to purge the - resulting data. Required. - :paramtype filters: - list[~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBodyFilters] - """ - super().__init__(**kwargs) - self.table = table - self.filters = filters - - -class ComponentPurgeBodyFilters(_serialization.Model): - """User-defined filters to return data which will be purged from the table. - - :ivar column: The column of the table over which the given query should run. - :vartype column: str - :ivar operator: A query operator to evaluate over the provided column and value(s). Supported - operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would - in a KQL query. - :vartype operator: str - :ivar value: the value for the operator to function over. This can be a number (e.g., > 100), a - string (timestamp >= '2017-09-01') or array of values. - :vartype value: any - :ivar key: When filtering over custom dimensions, this key will be used as the name of the - custom dimension. - :vartype key: str - """ - - _attribute_map = { - "column": {"key": "column", "type": "str"}, - "operator": {"key": "operator", "type": "str"}, - "value": {"key": "value", "type": "object"}, - "key": {"key": "key", "type": "str"}, - } - - def __init__( - self, - *, - column: Optional[str] = None, - operator: Optional[str] = None, - value: Optional[Any] = None, - key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword column: The column of the table over which the given query should run. - :paramtype column: str - :keyword operator: A query operator to evaluate over the provided column and value(s). - Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as - they would in a KQL query. - :paramtype operator: str - :keyword value: the value for the operator to function over. This can be a number (e.g., > - 100), a string (timestamp >= '2017-09-01') or array of values. - :paramtype value: any - :keyword key: When filtering over custom dimensions, this key will be used as the name of the - custom dimension. - :paramtype key: str - """ - super().__init__(**kwargs) - self.column = column - self.operator = operator - self.value = value - self.key = key - - -class ComponentPurgeResponse(_serialization.Model): - """Response containing operationId for a specific purge action. - - All required parameters must be populated in order to send to server. - - :ivar operation_id: Id to use when querying for status for a particular purge operation. - Required. - :vartype operation_id: str - """ - - _validation = { - "operation_id": {"required": True}, - } - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - } - - def __init__(self, *, operation_id: str, **kwargs: Any) -> None: - """ - :keyword operation_id: Id to use when querying for status for a particular purge operation. - Required. - :paramtype operation_id: str - """ - super().__init__(**kwargs) - self.operation_id = operation_id - - -class ComponentPurgeStatusResponse(_serialization.Model): - """Response containing status for a specific purge operation. - - All required parameters must be populated in order to send to server. - - :ivar status: Status of the operation represented by the requested Id. Required. Known values - are: "pending" and "completed". - :vartype status: str or ~azure.mgmt.applicationinsights.v2020_02_02.models.PurgeState - """ - - _validation = { - "status": {"required": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, *, status: Union[str, "_models.PurgeState"], **kwargs: Any) -> None: - """ - :keyword status: Status of the operation represented by the requested Id. Required. Known - values are: "pending" and "completed". - :paramtype status: str or ~azure.mgmt.applicationinsights.v2020_02_02.models.PurgeState - """ - super().__init__(**kwargs) - self.status = status - - -class ErrorResponseComponents(_serialization.Model): - """ErrorResponseComponents. - - :ivar error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :vartype error: ~azure.mgmt.applicationinsights.v2020_02_02.models.ErrorResponseComponentsError - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseComponentsError"}, - } - - def __init__(self, *, error: Optional["_models.ErrorResponseComponentsError"] = None, **kwargs: Any) -> None: - """ - :keyword error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :paramtype error: - ~azure.mgmt.applicationinsights.v2020_02_02.models.ErrorResponseComponentsError - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorResponseComponentsError(_serialization.Model): - """Error response indicates Insights service is not able to process the incoming request. The - reason is provided in the error message. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - - -class PrivateLinkScopedResource(_serialization.Model): - """The private link scope resource reference. - - :ivar resource_id: The full resource Id of the private link scope resource. - :vartype resource_id: str - :ivar scope_id: The private link scope unique Identifier. - :vartype scope_id: str - """ - - _attribute_map = { - "resource_id": {"key": "ResourceId", "type": "str"}, - "scope_id": {"key": "ScopeId", "type": "str"}, - } - - def __init__(self, *, resource_id: Optional[str] = None, scope_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resource_id: The full resource Id of the private link scope resource. - :paramtype resource_id: str - :keyword scope_id: The private link scope unique Identifier. - :paramtype scope_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.scope_id = scope_id - - -class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on a - WebTest instance. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/__init__.py deleted file mode 100644 index ab50c30fbaac..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._components_operations import ComponentsOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ComponentsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_components_operations.py deleted file mode 100644 index e9a03db31b40..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_components_operations.py +++ /dev/null @@ -1,1111 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components") - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2020-02-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2020-02-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, 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", "2020-02-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_tags_request( - resource_group_name: str, 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", "2020-02-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_purge_request( - resource_group_name: str, 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", "2020-02-02")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_purge_status_request( - resource_group_name: str, resource_name: str, purge_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", "2020-02-02")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_02_02.ApplicationInsightsManagementClient`'s - :attr:`components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of all Application Insights components within a subscription. - - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of Application Insights components within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", 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.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Deletes an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ApplicationInsightsComponent: - """Returns an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: _models.ApplicationInsightsComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. - Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent or IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(insight_properties, (IOBase, bytes)): - _content = insight_properties - else: - _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02.models.TagsResource or - IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(component_tags, (IOBase, bytes)): - _content = component_tags - else: - _json = self._serialize.body(component_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def purge( - self, - resource_group_name: str, - resource_name: str, - body: _models.ComponentPurgeBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - Note: this operation is intended for Classic resources, for workspace-based Application - Insights resource please run purge operation (directly on the - workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , - scoped to specific resource id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def purge( - self, - resource_group_name: str, - resource_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - Note: this operation is intended for Classic resources, for workspace-based Application - Insights resource please run purge operation (directly on the - workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , - scoped to specific resource id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def purge( - self, - resource_group_name: str, - resource_name: str, - body: Union[_models.ComponentPurgeBody, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - Note: this operation is intended for Classic resources, for workspace-based Application - Insights resource please run purge operation (directly on the - workspace)(https://docs.microsoft.com/en-us/rest/api/loganalytics/workspace-purge/purge) , - scoped to specific resource id. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeBody or IO[bytes] - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "ComponentPurgeBody") - - _request = build_purge_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_purge_status( - self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any - ) -> _models.ComponentPurgeStatusResponse: - """Get status for an ongoing purge operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param purge_id: In a purge status request, this is the Id of the operation the status of which - is returned. Required. - :type purge_id: str - :return: ComponentPurgeStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02.models.ComponentPurgeStatusResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) - - _request = build_get_purge_status_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - purge_id=purge_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseComponents, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_application_insights_management_client.py deleted file mode 100644 index 1eeeb60e6df9..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_application_insights_management_client.py +++ /dev/null @@ -1,128 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import ComponentsOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar components: ComponentsOperations operations - :vartype components: - azure.mgmt.applicationinsights.v2020_02_02_preview.operations.ComponentsOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-02-02-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_configuration.py deleted file mode 100644 index 3625df15bc75..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-02-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2020-02-02-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_application_insights_management_client.py deleted file mode 100644 index 9c564cdf2f1e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_application_insights_management_client.py +++ /dev/null @@ -1,132 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import ComponentsOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar components: ComponentsOperations operations - :vartype components: - azure.mgmt.applicationinsights.v2020_02_02_preview.aio.operations.ComponentsOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-02-02-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.components = ComponentsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_configuration.py deleted file mode 100644 index 83eed3c75f44..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-02-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2020-02-02-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/__init__.py deleted file mode 100644 index ab50c30fbaac..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._components_operations import ComponentsOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ComponentsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_components_operations.py deleted file mode 100644 index 6cd1abf32b45..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_components_operations.py +++ /dev/null @@ -1,849 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._components_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_purge_status_request, - build_get_request, - build_list_by_resource_group_request, - build_list_request, - build_purge_request, - build_update_tags_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_02_02_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of all Application Insights components within a subscription. - - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of Application Insights components within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Deletes an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Returns an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: _models.ApplicationInsightsComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. - Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent or - IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(insight_properties, (IOBase, bytes)): - _content = insight_properties - else: - _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.TagsResource - or IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(component_tags, (IOBase, bytes)): - _content = component_tags - else: - _json = self._serialize.body(component_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: _models.ComponentPurgeBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def purge( - self, - resource_group_name: str, - resource_name: str, - body: Union[_models.ComponentPurgeBody, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBody or - IO[bytes] - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "ComponentPurgeBody") - - _request = build_purge_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_purge_status( - self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any - ) -> _models.ComponentPurgeStatusResponse: - """Get status for an ongoing purge operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param purge_id: In a purge status request, this is the Id of the operation the status of which - is returned. Required. - :type purge_id: str - :return: ComponentPurgeStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeStatusResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) - - _request = build_get_purge_status_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - purge_id=purge_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/__init__.py deleted file mode 100644 index 1b67924f17b2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/__init__.py +++ /dev/null @@ -1,64 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ApplicationInsightsComponent, - ApplicationInsightsComponentListResult, - ComponentPurgeBody, - ComponentPurgeBodyFilters, - ComponentPurgeResponse, - ComponentPurgeStatusResponse, - ComponentsResource, - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - PrivateLinkScopedResource, - TagsResource, -) - -from ._application_insights_management_client_enums import ( # type: ignore - ApplicationType, - FlowType, - IngestionMode, - PublicNetworkAccessType, - PurgeState, - RequestSource, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsComponent", - "ApplicationInsightsComponentListResult", - "ComponentPurgeBody", - "ComponentPurgeBodyFilters", - "ComponentPurgeResponse", - "ComponentPurgeStatusResponse", - "ComponentsResource", - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "PrivateLinkScopedResource", - "TagsResource", - "ApplicationType", - "FlowType", - "IngestionMode", - "PublicNetworkAccessType", - "PurgeState", - "RequestSource", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_application_insights_management_client_enums.py deleted file mode 100644 index 8b3d890ab9d8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_application_insights_management_client_enums.py +++ /dev/null @@ -1,60 +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 ApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of application being monitored.""" - - WEB = "web" - OTHER = "other" - - -class FlowType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Used by the Application Insights system to determine what kind of flow this component was - created by. This is to be set to 'Bluefield' when creating/updating a component via the REST - API. - """ - - BLUEFIELD = "Bluefield" - - -class IngestionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates the flow of the ingestion.""" - - APPLICATION_INSIGHTS = "ApplicationInsights" - APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS = "ApplicationInsightsWithDiagnosticSettings" - LOG_ANALYTICS = "LogAnalytics" - - -class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The network access type for operating on the Application Insights Component. By default it is - Enabled. - """ - - ENABLED = "Enabled" - """Enables connectivity to Application Insights through public DNS.""" - DISABLED = "Disabled" - """Disables public connectivity to Application Insights through public DNS.""" - - -class PurgeState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the operation represented by the requested Id.""" - - PENDING = "pending" - COMPLETED = "completed" - - -class RequestSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Describes what tool created this Application Insights component. Customers using this API - should set this to the default 'rest'. - """ - - REST = "rest" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_models_py3.py deleted file mode 100644 index 383d911f85b4..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_models_py3.py +++ /dev/null @@ -1,657 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from collections.abc import MutableMapping -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class ComponentsResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class ApplicationInsightsComponent(ComponentsResource): - """An Application Insights component definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: The kind of application that this component refers to, used to customize UI. This - value is a freeform string, values should typically be one of the following: web, ios, other, - store, java, phone. Required. - :vartype kind: str - :ivar etag: Resource etag. - :vartype etag: str - :ivar application_id: The unique ID of your application. This field mirrors the 'Name' field - and cannot be changed. - :vartype application_id: str - :ivar app_id: Application Insights Unique ID for your Application. - :vartype app_id: str - :ivar name_properties_name: Application name. - :vartype name_properties_name: str - :ivar application_type: Type of application being monitored. Known values are: "web" and - "other". - :vartype application_type: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationType - :ivar flow_type: Used by the Application Insights system to determine what kind of flow this - component was created by. This is to be set to 'Bluefield' when creating/updating a component - via the REST API. "Bluefield" - :vartype flow_type: str or ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.FlowType - :ivar request_source: Describes what tool created this Application Insights component. - Customers using this API should set this to the default 'rest'. "rest" - :vartype request_source: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.RequestSource - :ivar instrumentation_key: Application Insights Instrumentation key. A read-only value that - applications can use to identify the destination for all telemetry sent to Azure Application - Insights. This value will be supplied upon construction of each new Application Insights - component. - :vartype instrumentation_key: str - :ivar creation_date: Creation Date for the Application Insights component, in ISO 8601 format. - :vartype creation_date: ~datetime.datetime - :ivar tenant_id: Azure Tenant Id. - :vartype tenant_id: str - :ivar hockey_app_id: The unique application ID created when a new application is added to - HockeyApp, used for communications with HockeyApp. - :vartype hockey_app_id: str - :ivar hockey_app_token: Token used to authenticate communications with between Application - Insights and HockeyApp. - :vartype hockey_app_token: str - :ivar provisioning_state: Current state of this component: whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. - :vartype provisioning_state: str - :ivar sampling_percentage: Percentage of the data produced by the application being monitored - that is being sampled for Application Insights telemetry. - :vartype sampling_percentage: float - :ivar connection_string: Application Insights component connection string. - :vartype connection_string: str - :ivar retention_in_days: Retention period in days. - :vartype retention_in_days: int - :ivar disable_ip_masking: Disable IP masking. - :vartype disable_ip_masking: bool - :ivar immediate_purge_data_on30_days: Purge data immediately after 30 days. - :vartype immediate_purge_data_on30_days: bool - :ivar workspace_resource_id: Resource Id of the log analytics workspace which the data will be - ingested to. This property is required to create an application with this API version. - Applications from older versions will not have this property. - :vartype workspace_resource_id: str - :ivar la_migration_date: The date which the component got migrated to LA, in ISO 8601 format. - :vartype la_migration_date: ~datetime.datetime - :ivar private_link_scoped_resources: List of linked private link scope resources. - :vartype private_link_scoped_resources: - list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PrivateLinkScopedResource] - :ivar public_network_access_for_ingestion: The network access type for accessing Application - Insights ingestion. Known values are: "Enabled" and "Disabled". - :vartype public_network_access_for_ingestion: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PublicNetworkAccessType - :ivar public_network_access_for_query: The network access type for accessing Application - Insights query. Known values are: "Enabled" and "Disabled". - :vartype public_network_access_for_query: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PublicNetworkAccessType - :ivar ingestion_mode: Indicates the flow of the ingestion. Known values are: - "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". - :vartype ingestion_mode: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.IngestionMode - :ivar disable_local_auth: Disable Non-AAD based Auth. - :vartype disable_local_auth: bool - :ivar force_customer_storage_for_profiler: Force users to create their own storage account for - profiler and debugger. - :vartype force_customer_storage_for_profiler: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "kind": {"required": True}, - "application_id": {"readonly": True}, - "app_id": {"readonly": True}, - "name_properties_name": {"readonly": True}, - "instrumentation_key": {"readonly": True}, - "creation_date": {"readonly": True}, - "tenant_id": {"readonly": True}, - "hockey_app_token": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "connection_string": {"readonly": True}, - "retention_in_days": {"readonly": True}, - "la_migration_date": {"readonly": True}, - "private_link_scoped_resources": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "application_id": {"key": "properties.ApplicationId", "type": "str"}, - "app_id": {"key": "properties.AppId", "type": "str"}, - "name_properties_name": {"key": "properties.Name", "type": "str"}, - "application_type": {"key": "properties.Application_Type", "type": "str"}, - "flow_type": {"key": "properties.Flow_Type", "type": "str"}, - "request_source": {"key": "properties.Request_Source", "type": "str"}, - "instrumentation_key": {"key": "properties.InstrumentationKey", "type": "str"}, - "creation_date": {"key": "properties.CreationDate", "type": "iso-8601"}, - "tenant_id": {"key": "properties.TenantId", "type": "str"}, - "hockey_app_id": {"key": "properties.HockeyAppId", "type": "str"}, - "hockey_app_token": {"key": "properties.HockeyAppToken", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "sampling_percentage": {"key": "properties.SamplingPercentage", "type": "float"}, - "connection_string": {"key": "properties.ConnectionString", "type": "str"}, - "retention_in_days": {"key": "properties.RetentionInDays", "type": "int"}, - "disable_ip_masking": {"key": "properties.DisableIpMasking", "type": "bool"}, - "immediate_purge_data_on30_days": {"key": "properties.ImmediatePurgeDataOn30Days", "type": "bool"}, - "workspace_resource_id": {"key": "properties.WorkspaceResourceId", "type": "str"}, - "la_migration_date": {"key": "properties.LaMigrationDate", "type": "iso-8601"}, - "private_link_scoped_resources": { - "key": "properties.PrivateLinkScopedResources", - "type": "[PrivateLinkScopedResource]", - }, - "public_network_access_for_ingestion": {"key": "properties.publicNetworkAccessForIngestion", "type": "str"}, - "public_network_access_for_query": {"key": "properties.publicNetworkAccessForQuery", "type": "str"}, - "ingestion_mode": {"key": "properties.IngestionMode", "type": "str"}, - "disable_local_auth": {"key": "properties.DisableLocalAuth", "type": "bool"}, - "force_customer_storage_for_profiler": {"key": "properties.ForceCustomerStorageForProfiler", "type": "bool"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - kind: str, - tags: Optional[dict[str, str]] = None, - etag: Optional[str] = None, - application_type: Union[str, "_models.ApplicationType"] = "web", - flow_type: Union[str, "_models.FlowType"] = "Bluefield", - request_source: Union[str, "_models.RequestSource"] = "rest", - hockey_app_id: Optional[str] = None, - sampling_percentage: Optional[float] = None, - disable_ip_masking: Optional[bool] = None, - immediate_purge_data_on30_days: Optional[bool] = None, - workspace_resource_id: Optional[str] = None, - public_network_access_for_ingestion: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", - public_network_access_for_query: Union[str, "_models.PublicNetworkAccessType"] = "Enabled", - ingestion_mode: Union[str, "_models.IngestionMode"] = "LogAnalytics", - disable_local_auth: Optional[bool] = None, - force_customer_storage_for_profiler: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword kind: The kind of application that this component refers to, used to customize UI. - This value is a freeform string, values should typically be one of the following: web, ios, - other, store, java, phone. Required. - :paramtype kind: str - :keyword etag: Resource etag. - :paramtype etag: str - :keyword application_type: Type of application being monitored. Known values are: "web" and - "other". - :paramtype application_type: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationType - :keyword flow_type: Used by the Application Insights system to determine what kind of flow this - component was created by. This is to be set to 'Bluefield' when creating/updating a component - via the REST API. "Bluefield" - :paramtype flow_type: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.FlowType - :keyword request_source: Describes what tool created this Application Insights component. - Customers using this API should set this to the default 'rest'. "rest" - :paramtype request_source: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.RequestSource - :keyword hockey_app_id: The unique application ID created when a new application is added to - HockeyApp, used for communications with HockeyApp. - :paramtype hockey_app_id: str - :keyword sampling_percentage: Percentage of the data produced by the application being - monitored that is being sampled for Application Insights telemetry. - :paramtype sampling_percentage: float - :keyword disable_ip_masking: Disable IP masking. - :paramtype disable_ip_masking: bool - :keyword immediate_purge_data_on30_days: Purge data immediately after 30 days. - :paramtype immediate_purge_data_on30_days: bool - :keyword workspace_resource_id: Resource Id of the log analytics workspace which the data will - be ingested to. This property is required to create an application with this API version. - Applications from older versions will not have this property. - :paramtype workspace_resource_id: str - :keyword public_network_access_for_ingestion: The network access type for accessing Application - Insights ingestion. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access_for_ingestion: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PublicNetworkAccessType - :keyword public_network_access_for_query: The network access type for accessing Application - Insights query. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access_for_query: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PublicNetworkAccessType - :keyword ingestion_mode: Indicates the flow of the ingestion. Known values are: - "ApplicationInsights", "ApplicationInsightsWithDiagnosticSettings", and "LogAnalytics". - :paramtype ingestion_mode: str or - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.IngestionMode - :keyword disable_local_auth: Disable Non-AAD based Auth. - :paramtype disable_local_auth: bool - :keyword force_customer_storage_for_profiler: Force users to create their own storage account - for profiler and debugger. - :paramtype force_customer_storage_for_profiler: bool - """ - super().__init__(location=location, tags=tags, **kwargs) - self.kind = kind - self.etag = etag - self.application_id: Optional[str] = None - self.app_id: Optional[str] = None - self.name_properties_name: Optional[str] = None - self.application_type = application_type - self.flow_type = flow_type - self.request_source = request_source - self.instrumentation_key: Optional[str] = None - self.creation_date: Optional[datetime.datetime] = None - self.tenant_id: Optional[str] = None - self.hockey_app_id = hockey_app_id - self.hockey_app_token: Optional[str] = None - self.provisioning_state: Optional[str] = None - self.sampling_percentage = sampling_percentage - self.connection_string: Optional[str] = None - self.retention_in_days: Optional[int] = None - self.disable_ip_masking = disable_ip_masking - self.immediate_purge_data_on30_days = immediate_purge_data_on30_days - self.workspace_resource_id = workspace_resource_id - self.la_migration_date: Optional[datetime.datetime] = None - self.private_link_scoped_resources: Optional[list["_models.PrivateLinkScopedResource"]] = None - self.public_network_access_for_ingestion = public_network_access_for_ingestion - self.public_network_access_for_query = public_network_access_for_query - self.ingestion_mode = ingestion_mode - self.disable_local_auth = disable_local_auth - self.force_customer_storage_for_profiler = force_customer_storage_for_profiler - - -class ApplicationInsightsComponentListResult(_serialization.Model): - """Describes the list of Application Insights Resources. - - All required parameters must be populated in order to send to server. - - :ivar value: List of Application Insights component definitions. Required. - :vartype value: - list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] - :ivar next_link: The URI to get the next set of Application Insights component definitions if - too many components where returned in the result set. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationInsightsComponent]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: list["_models.ApplicationInsightsComponent"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of Application Insights component definitions. Required. - :paramtype value: - list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] - :keyword next_link: The URI to get the next set of Application Insights component definitions - if too many components where returned in the result set. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ComponentPurgeBody(_serialization.Model): - """Describes the body of a purge request for an App Insights component. - - All required parameters must be populated in order to send to server. - - :ivar table: Table from which to purge data. Required. - :vartype table: str - :ivar filters: The set of columns and filters (queries) to run over them to purge the resulting - data. Required. - :vartype filters: - list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBodyFilters] - """ - - _validation = { - "table": {"required": True}, - "filters": {"required": True}, - } - - _attribute_map = { - "table": {"key": "table", "type": "str"}, - "filters": {"key": "filters", "type": "[ComponentPurgeBodyFilters]"}, - } - - def __init__(self, *, table: str, filters: list["_models.ComponentPurgeBodyFilters"], **kwargs: Any) -> None: - """ - :keyword table: Table from which to purge data. Required. - :paramtype table: str - :keyword filters: The set of columns and filters (queries) to run over them to purge the - resulting data. Required. - :paramtype filters: - list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBodyFilters] - """ - super().__init__(**kwargs) - self.table = table - self.filters = filters - - -class ComponentPurgeBodyFilters(_serialization.Model): - """User-defined filters to return data which will be purged from the table. - - :ivar column: The column of the table over which the given query should run. - :vartype column: str - :ivar operator: A query operator to evaluate over the provided column and value(s). Supported - operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would - in a KQL query. - :vartype operator: str - :ivar value: the value for the operator to function over. This can be a number (e.g., > 100), a - string (timestamp >= '2017-09-01') or array of values. - :vartype value: any - :ivar key: When filtering over custom dimensions, this key will be used as the name of the - custom dimension. - :vartype key: str - """ - - _attribute_map = { - "column": {"key": "column", "type": "str"}, - "operator": {"key": "operator", "type": "str"}, - "value": {"key": "value", "type": "object"}, - "key": {"key": "key", "type": "str"}, - } - - def __init__( - self, - *, - column: Optional[str] = None, - operator: Optional[str] = None, - value: Optional[Any] = None, - key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword column: The column of the table over which the given query should run. - :paramtype column: str - :keyword operator: A query operator to evaluate over the provided column and value(s). - Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as - they would in a KQL query. - :paramtype operator: str - :keyword value: the value for the operator to function over. This can be a number (e.g., > - 100), a string (timestamp >= '2017-09-01') or array of values. - :paramtype value: any - :keyword key: When filtering over custom dimensions, this key will be used as the name of the - custom dimension. - :paramtype key: str - """ - super().__init__(**kwargs) - self.column = column - self.operator = operator - self.value = value - self.key = key - - -class ComponentPurgeResponse(_serialization.Model): - """Response containing operationId for a specific purge action. - - All required parameters must be populated in order to send to server. - - :ivar operation_id: Id to use when querying for status for a particular purge operation. - Required. - :vartype operation_id: str - """ - - _validation = { - "operation_id": {"required": True}, - } - - _attribute_map = { - "operation_id": {"key": "operationId", "type": "str"}, - } - - def __init__(self, *, operation_id: str, **kwargs: Any) -> None: - """ - :keyword operation_id: Id to use when querying for status for a particular purge operation. - Required. - :paramtype operation_id: str - """ - super().__init__(**kwargs) - self.operation_id = operation_id - - -class ComponentPurgeStatusResponse(_serialization.Model): - """Response containing status for a specific purge operation. - - All required parameters must be populated in order to send to server. - - :ivar status: Status of the operation represented by the requested Id. Required. Known values - are: "pending" and "completed". - :vartype status: str or ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PurgeState - """ - - _validation = { - "status": {"required": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, *, status: Union[str, "_models.PurgeState"], **kwargs: Any) -> None: - """ - :keyword status: Status of the operation represented by the requested Id. Required. Known - values are: "pending" and "completed". - :paramtype status: str or ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.PurgeState - """ - super().__init__(**kwargs) - self.status = status - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.info: Optional[JSON] = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.target: Optional[str] = None - self.details: Optional[list["_models.ErrorDetail"]] = None - self.additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class PrivateLinkScopedResource(_serialization.Model): - """The private link scope resource reference. - - :ivar resource_id: The full resource Id of the private link scope resource. - :vartype resource_id: str - :ivar scope_id: The private link scope unique Identifier. - :vartype scope_id: str - """ - - _attribute_map = { - "resource_id": {"key": "ResourceId", "type": "str"}, - "scope_id": {"key": "ScopeId", "type": "str"}, - } - - def __init__(self, *, resource_id: Optional[str] = None, scope_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword resource_id: The full resource Id of the private link scope resource. - :paramtype resource_id: str - :keyword scope_id: The private link scope unique Identifier. - :paramtype scope_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.scope_id = scope_id - - -class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on a - WebTest instance. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/__init__.py deleted file mode 100644 index ab50c30fbaac..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._components_operations import ComponentsOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ComponentsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_components_operations.py deleted file mode 100644 index 50950fb0869c..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_components_operations.py +++ /dev/null @@ -1,1101 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components") - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2020-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2020-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, 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", "2020-02-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_tags_request( - resource_group_name: str, 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", "2020-02-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_purge_request( - resource_group_name: str, 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", "2020-02-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_purge_status_request( - resource_group_name: str, resource_name: str, purge_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", "2020-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "purgeId": _SERIALIZER.url("purge_id", purge_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ComponentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_02_02_preview.ApplicationInsightsManagementClient`'s - :attr:`components` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of all Application Insights components within a subscription. - - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.ApplicationInsightsComponent"]: - """Gets a list of Application Insights components within a resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either ApplicationInsightsComponent or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponentListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApplicationInsightsComponentListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Deletes an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.ApplicationInsightsComponent: - """Returns an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: _models.ApplicationInsightsComponent, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Required. - :type insight_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - insight_properties: Union[_models.ApplicationInsightsComponent, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Creates (or updates) an Application Insights component. Note: You cannot specify a different - value for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param insight_properties: Properties that need to be specified to create an Application - Insights component. Is either a ApplicationInsightsComponent type or a IO[bytes] type. - Required. - :type insight_properties: - ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent or - IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(insight_properties, (IOBase, bytes)): - _content = insight_properties - else: - _json = self._serialize.body(insight_properties, "ApplicationInsightsComponent") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Required. - :type component_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_tags( - self, - resource_group_name: str, - resource_name: str, - component_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationInsightsComponent: - """Updates an existing component's tags. To update other fields use the CreateOrUpdate method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param component_tags: Updated tag information to set into the component instance. Is either a - TagsResource type or a IO[bytes] type. Required. - :type component_tags: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.TagsResource - or IO[bytes] - :return: ApplicationInsightsComponent or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ApplicationInsightsComponent - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ApplicationInsightsComponent] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(component_tags, (IOBase, bytes)): - _content = component_tags - else: - _json = self._serialize.body(component_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationInsightsComponent", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def purge( - self, - resource_group_name: str, - resource_name: str, - body: _models.ComponentPurgeBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def purge( - self, - resource_group_name: str, - resource_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def purge( - self, - resource_group_name: str, - resource_name: str, - body: Union[_models.ComponentPurgeBody, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentPurgeResponse: - """Purges data in an Application Insights component by a set of user-defined filters. - - In order to manage system resources, purge requests are throttled at 50 requests per hour. You - should batch the execution of purge requests by sending a single command whose predicate - includes all user identities that require purging. Use the in operator to specify multiple - identities. You should run the query prior to using for a purge request to verify that the - results are expected. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param body: Describes the body of a request to purge data in a single table of an Application - Insights component. Is either a ComponentPurgeBody type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeBody or - IO[bytes] - :return: ComponentPurgeResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentPurgeResponse] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "ComponentPurgeBody") - - _request = build_purge_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_purge_status( - self, resource_group_name: str, resource_name: str, purge_id: str, **kwargs: Any - ) -> _models.ComponentPurgeStatusResponse: - """Get status for an ongoing purge operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param purge_id: In a purge status request, this is the Id of the operation the status of which - is returned. Required. - :type purge_id: str - :return: ComponentPurgeStatusResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_02_02_preview.models.ComponentPurgeStatusResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentPurgeStatusResponse] = kwargs.pop("cls", None) - - _request = build_get_purge_status_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - purge_id=purge_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentPurgeStatusResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_02_02_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_application_insights_management_client.py deleted file mode 100644 index bccc8674ffca..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_application_insights_management_client.py +++ /dev/null @@ -1,130 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import ComponentLinkedStorageAccountsOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar component_linked_storage_accounts: ComponentLinkedStorageAccountsOperations operations - :vartype component_linked_storage_accounts: - azure.mgmt.applicationinsights.v2020_03_01_preview.operations.ComponentLinkedStorageAccountsOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-03-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.component_linked_storage_accounts = ComponentLinkedStorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_configuration.py deleted file mode 100644 index a499beec345b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-03-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, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2020-03-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_application_insights_management_client.py deleted file mode 100644 index e89a4a0fd39b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_application_insights_management_client.py +++ /dev/null @@ -1,134 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import ComponentLinkedStorageAccountsOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar component_linked_storage_accounts: ComponentLinkedStorageAccountsOperations operations - :vartype component_linked_storage_accounts: - azure.mgmt.applicationinsights.v2020_03_01_preview.aio.operations.ComponentLinkedStorageAccountsOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-03-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.component_linked_storage_accounts = ComponentLinkedStorageAccountsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_configuration.py deleted file mode 100644 index 79032cafee72..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-03-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, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2020-03-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/__init__.py deleted file mode 100644 index 674336f5dd75..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._component_linked_storage_accounts_operations import ComponentLinkedStorageAccountsOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ComponentLinkedStorageAccountsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_component_linked_storage_accounts_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_component_linked_storage_accounts_operations.py deleted file mode 100644 index be8131fbaecc..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_component_linked_storage_accounts_operations.py +++ /dev/null @@ -1,507 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._component_linked_storage_accounts_operations import ( - build_create_and_update_request, - build_delete_request, - build_get_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class ComponentLinkedStorageAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_03_01_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`component_linked_storage_accounts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, storage_type: Union[str, _models.StorageType], **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Returns the current linked storage settings for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - storage_type=storage_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_and_update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: _models.ComponentLinkedStorageAccounts, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Replace current linked storage account for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update - linked storage accounts for an Application Insights component. Required. - :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_and_update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Replace current linked storage account for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update - linked storage accounts for an Application Insights component. Required. - :type linked_storage_accounts_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_and_update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: Union[_models.ComponentLinkedStorageAccounts, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Replace current linked storage account for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update - linked storage accounts for an Application Insights component. Is either a - ComponentLinkedStorageAccounts type or a IO[bytes] type. Required. - :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts or - IO[bytes] - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): - _content = linked_storage_accounts_properties - else: - _json = self._serialize.body(linked_storage_accounts_properties, "ComponentLinkedStorageAccounts") - - _request = build_create_and_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - storage_type=storage_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: _models.ComponentLinkedStorageAccountsPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Update linked storage accounts for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update a - linked storage accounts for an Application Insights component. Required. - :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccountsPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Update linked storage accounts for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update a - linked storage accounts for an Application Insights component. Required. - :type linked_storage_accounts_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: Union[_models.ComponentLinkedStorageAccountsPatch, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Update linked storage accounts for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update a - linked storage accounts for an Application Insights component. Is either a - ComponentLinkedStorageAccountsPatch type or a IO[bytes] type. Required. - :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccountsPatch - or IO[bytes] - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): - _content = linked_storage_accounts_properties - else: - _json = self._serialize.body(linked_storage_accounts_properties, "ComponentLinkedStorageAccountsPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - storage_type=storage_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, resource_group_name: str, resource_name: str, storage_type: Union[str, _models.StorageType], **kwargs: Any - ) -> None: - """Delete linked storage accounts for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - storage_type=storage_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/__init__.py deleted file mode 100644 index 5289496d8064..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/__init__.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ComponentLinkedStorageAccounts, - ComponentLinkedStorageAccountsPatch, - ErrorResponseLinkedStorage, - ErrorResponseLinkedStorageError, - ProxyResource, - Resource, -) - -from ._application_insights_management_client_enums import ( # type: ignore - StorageType, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ComponentLinkedStorageAccounts", - "ComponentLinkedStorageAccountsPatch", - "ErrorResponseLinkedStorage", - "ErrorResponseLinkedStorageError", - "ProxyResource", - "Resource", - "StorageType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_application_insights_management_client_enums.py deleted file mode 100644 index a33a8a879fb3..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_application_insights_management_client_enums.py +++ /dev/null @@ -1,16 +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 StorageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """StorageType.""" - - SERVICE_PROFILER = "ServiceProfiler" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_models_py3.py deleted file mode 100644 index 9d2109f0a7c5..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_models_py3.py +++ /dev/null @@ -1,179 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, Optional, TYPE_CHECKING - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -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: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = 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 - """ - - -class ComponentLinkedStorageAccounts(ProxyResource): - """An Application Insights component linked storage accounts. - - 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 linked_storage_account: Linked storage account resource ID. - :vartype linked_storage_account: 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"}, - "linked_storage_account": {"key": "properties.linkedStorageAccount", "type": "str"}, - } - - def __init__(self, *, linked_storage_account: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword linked_storage_account: Linked storage account resource ID. - :paramtype linked_storage_account: str - """ - super().__init__(**kwargs) - self.linked_storage_account = linked_storage_account - - -class ComponentLinkedStorageAccountsPatch(_serialization.Model): - """An Application Insights component linked storage accounts patch. - - :ivar linked_storage_account: Linked storage account resource ID. - :vartype linked_storage_account: str - """ - - _attribute_map = { - "linked_storage_account": {"key": "properties.linkedStorageAccount", "type": "str"}, - } - - def __init__(self, *, linked_storage_account: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword linked_storage_account: Linked storage account resource ID. - :paramtype linked_storage_account: str - """ - super().__init__(**kwargs) - self.linked_storage_account = linked_storage_account - - -class ErrorResponseLinkedStorage(_serialization.Model): - """ErrorResponseLinkedStorage. - - :ivar error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :vartype error: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ErrorResponseLinkedStorageError - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseLinkedStorageError"}, - } - - def __init__(self, *, error: Optional["_models.ErrorResponseLinkedStorageError"] = None, **kwargs: Any) -> None: - """ - :keyword error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :paramtype error: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ErrorResponseLinkedStorageError - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorResponseLinkedStorageError(_serialization.Model): - """Error response indicates Insights service is not able to process the incoming request. The - reason is provided in the error message. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/__init__.py deleted file mode 100644 index 674336f5dd75..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._component_linked_storage_accounts_operations import ComponentLinkedStorageAccountsOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ComponentLinkedStorageAccountsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_component_linked_storage_accounts_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_component_linked_storage_accounts_operations.py deleted file mode 100644 index 9e9c30d85601..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_component_linked_storage_accounts_operations.py +++ /dev/null @@ -1,663 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - 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", "2020-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_and_update_request( - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - 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", "2020-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - 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", "2020-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - 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", "2020-03-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "storageType": _SERIALIZER.url("storage_type", storage_type, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ComponentLinkedStorageAccountsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_03_01_preview.ApplicationInsightsManagementClient`'s - :attr:`component_linked_storage_accounts` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, storage_type: Union[str, _models.StorageType], **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Returns the current linked storage settings for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - storage_type=storage_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_and_update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: _models.ComponentLinkedStorageAccounts, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Replace current linked storage account for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update - linked storage accounts for an Application Insights component. Required. - :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_and_update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Replace current linked storage account for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update - linked storage accounts for an Application Insights component. Required. - :type linked_storage_accounts_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_and_update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: Union[_models.ComponentLinkedStorageAccounts, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Replace current linked storage account for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update - linked storage accounts for an Application Insights component. Is either a - ComponentLinkedStorageAccounts type or a IO[bytes] type. Required. - :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts or - IO[bytes] - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): - _content = linked_storage_accounts_properties - else: - _json = self._serialize.body(linked_storage_accounts_properties, "ComponentLinkedStorageAccounts") - - _request = build_create_and_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - storage_type=storage_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: _models.ComponentLinkedStorageAccountsPatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Update linked storage accounts for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update a - linked storage accounts for an Application Insights component. Required. - :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccountsPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Update linked storage accounts for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update a - linked storage accounts for an Application Insights component. Required. - :type linked_storage_accounts_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - storage_type: Union[str, _models.StorageType], - linked_storage_accounts_properties: Union[_models.ComponentLinkedStorageAccountsPatch, IO[bytes]], - **kwargs: Any - ) -> _models.ComponentLinkedStorageAccounts: - """Update linked storage accounts for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :param linked_storage_accounts_properties: Properties that need to be specified to update a - linked storage accounts for an Application Insights component. Is either a - ComponentLinkedStorageAccountsPatch type or a IO[bytes] type. Required. - :type linked_storage_accounts_properties: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccountsPatch - or IO[bytes] - :return: ComponentLinkedStorageAccounts or the result of cls(response) - :rtype: - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.ComponentLinkedStorageAccounts - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ComponentLinkedStorageAccounts] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(linked_storage_accounts_properties, (IOBase, bytes)): - _content = linked_storage_accounts_properties - else: - _json = self._serialize.body(linked_storage_accounts_properties, "ComponentLinkedStorageAccountsPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - storage_type=storage_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ComponentLinkedStorageAccounts", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, storage_type: Union[str, _models.StorageType], **kwargs: Any - ) -> None: - """Delete linked storage accounts for an Application Insights component. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param storage_type: The type of the Application Insights component data source for the linked - storage account. "ServiceProfiler" Required. - :type storage_type: str or - ~azure.mgmt.applicationinsights.v2020_03_01_preview.models.StorageType - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - storage_type=storage_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_03_01_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_application_insights_management_client.py deleted file mode 100644 index 691a5c968f81..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_application_insights_management_client.py +++ /dev/null @@ -1,124 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import LiveTokenOperations, Operations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.applicationinsights.v2020_06_02_preview.operations.Operations - :ivar live_token: LiveTokenOperations operations - :vartype live_token: - azure.mgmt.applicationinsights.v2020_06_02_preview.operations.LiveTokenOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-06-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - base_url: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_configuration.py deleted file mode 100644 index 15231ed11942..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-06-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, credential: "TokenCredential", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2020-06-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.credential = credential - self.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_application_insights_management_client.py deleted file mode 100644 index d71572daed5d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_application_insights_management_client.py +++ /dev/null @@ -1,129 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import LiveTokenOperations, Operations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar operations: Operations operations - :vartype operations: - azure.mgmt.applicationinsights.v2020_06_02_preview.aio.operations.Operations - :ivar live_token: LiveTokenOperations operations - :vartype live_token: - azure.mgmt.applicationinsights.v2020_06_02_preview.aio.operations.LiveTokenOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-06-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - base_url: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs - ) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_configuration.py deleted file mode 100644 index 8248239c8ca2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-06-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, credential: "AsyncTokenCredential", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2020-06-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.credential = credential - self.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/__init__.py deleted file mode 100644 index a0f09b210fc1..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import Operations # type: ignore -from ._live_token_operations import LiveTokenOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "LiveTokenOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_live_token_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_live_token_operations.py deleted file mode 100644 index 2e34a471f3d8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_live_token_operations.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._live_token_operations import build_get_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class LiveTokenOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_06_02_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`live_token` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: - """**Gets an access token for live metrics stream data.**. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :return: LiveTokenResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.LiveTokenResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_uri=resource_uri, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LiveTokenResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_operations.py deleted file mode 100644 index ee36bfc89adf..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_06_02_preview.aio.ApplicationInsightsManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.OperationLive"]: - """List available operations. - - List the available operations supported by the resource provider. - - :return: An iterator like instance of either OperationLive or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationLive] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationsListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/__init__.py deleted file mode 100644 index 04eb8d951dbb..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/__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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ErrorResponseLinkedStorage, - ErrorResponseLinkedStorageError, - LiveTokenResponse, - OperationInfo, - OperationLive, - OperationsListResult, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ErrorResponseLinkedStorage", - "ErrorResponseLinkedStorageError", - "LiveTokenResponse", - "OperationInfo", - "OperationLive", - "OperationsListResult", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_models_py3.py deleted file mode 100644 index 63c5297a8528..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_models_py3.py +++ /dev/null @@ -1,213 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from collections.abc import MutableMapping -from typing import Any, Optional, TYPE_CHECKING - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class ErrorResponseLinkedStorage(_serialization.Model): - """ErrorResponseLinkedStorage. - - :ivar error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :vartype error: - ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.ErrorResponseLinkedStorageError - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseLinkedStorageError"}, - } - - def __init__(self, *, error: Optional["_models.ErrorResponseLinkedStorageError"] = None, **kwargs: Any) -> None: - """ - :keyword error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :paramtype error: - ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.ErrorResponseLinkedStorageError - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorResponseLinkedStorageError(_serialization.Model): - """Error response indicates Insights service is not able to process the incoming request. The - reason is provided in the error message. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - - -class LiveTokenResponse(_serialization.Model): - """The response to a live token query. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar live_token: JWT token for accessing live metrics stream data. - :vartype live_token: str - """ - - _validation = { - "live_token": {"readonly": True}, - } - - _attribute_map = { - "live_token": {"key": "liveToken", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.live_token: Optional[str] = None - - -class OperationInfo(_serialization.Model): - """Information about an operation. - - :ivar provider: Name of the provider. - :vartype provider: str - :ivar resource: Name of the resource type. - :vartype resource: str - :ivar operation: Name of the operation. - :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: Name of the provider. - :paramtype provider: str - :keyword resource: Name of the resource type. - :paramtype resource: str - :keyword operation: Name of the operation. - :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 OperationLive(_serialization.Model): - """Represents an operation returned by the GetOperations request. - - :ivar name: Name of the operation. - :vartype name: str - :ivar display: Display name of the operation. - :vartype display: ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationInfo - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: JSON - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationInfo"}, - "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "object"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.OperationInfo"] = None, - origin: Optional[str] = None, - properties: Optional[JSON] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the operation. - :paramtype name: str - :keyword display: Display name of the operation. - :paramtype display: ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationInfo - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: JSON - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.origin = origin - self.properties = properties - - -class OperationsListResult(_serialization.Model): - """Result of the List Operations operation. - - :ivar value: A collection of operations. - :vartype value: list[~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationLive] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationLive]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.OperationLive"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: A collection of operations. - :paramtype value: - list[~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationLive] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/__init__.py deleted file mode 100644 index a0f09b210fc1..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._operations import Operations # type: ignore -from ._live_token_operations import LiveTokenOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "LiveTokenOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_live_token_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_live_token_operations.py deleted file mode 100644 index 14e6e0d83d7d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_live_token_operations.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_uri: 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", "2020-06-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/microsoft.insights/generatelivetoken") - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class LiveTokenOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_06_02_preview.ApplicationInsightsManagementClient`'s - :attr:`live_token` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: - """**Gets an access token for live metrics stream data.**. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :return: LiveTokenResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_06_02_preview.models.LiveTokenResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_uri=resource_uri, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LiveTokenResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_operations.py deleted file mode 100644 index f5fe8035def0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_operations.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 collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-06-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/microsoft.insights/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.applicationinsights.v2020_06_02_preview.ApplicationInsightsManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.OperationLive"]: - """List available operations. - - List the available operations supported by the resource provider. - - :return: An iterator like instance of either OperationLive or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_06_02_preview.models.OperationLive] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OperationsListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_06_02_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_application_insights_management_client.py deleted file mode 100644 index 8bf4b12ceb58..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_application_insights_management_client.py +++ /dev/null @@ -1,130 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import WorkbookTemplatesOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar workbook_templates: WorkbookTemplatesOperations operations - :vartype workbook_templates: - azure.mgmt.applicationinsights.v2020_11_20.operations.WorkbookTemplatesOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-11-20". 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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.workbook_templates = WorkbookTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_configuration.py deleted file mode 100644 index 991ac104de48..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-11-20". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2020-11-20") - - 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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_application_insights_management_client.py deleted file mode 100644 index 980d46a5c9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_application_insights_management_client.py +++ /dev/null @@ -1,134 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import WorkbookTemplatesOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar workbook_templates: WorkbookTemplatesOperations operations - :vartype workbook_templates: - azure.mgmt.applicationinsights.v2020_11_20.aio.operations.WorkbookTemplatesOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-11-20". 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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.workbook_templates = WorkbookTemplatesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_configuration.py deleted file mode 100644 index e85cc6bdc99b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2020-11-20". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2020-11-20") - - 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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/__init__.py deleted file mode 100644 index aa730bc20e57..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._workbook_templates_operations import WorkbookTemplatesOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbookTemplatesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_workbook_templates_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_workbook_templates_operations.py deleted file mode 100644 index 63a0fcace888..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/aio/operations/_workbook_templates_operations.py +++ /dev/null @@ -1,547 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._workbook_templates_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class WorkbookTemplatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_11_20.aio.ApplicationInsightsManagementClient`'s - :attr:`workbook_templates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.WorkbookTemplate"]: - """Get all Workbook templates defined within a specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WorkbookTemplate or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbookTemplatesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.WorkbookTemplateError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.WorkbookTemplate: - """Get a single workbook template by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookTemplateError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Delete a workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookTemplateError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: _models.WorkbookTemplate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Required. - :type workbook_template_properties: - ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Required. - :type workbook_template_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: Union[_models.WorkbookTemplate, IO[bytes]], - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Is either a WorkbookTemplate type or a IO[bytes] type. Required. - :type workbook_template_properties: - ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate or IO[bytes] - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_template_properties, (IOBase, bytes)): - _content = workbook_template_properties - else: - _json = self._serialize.body(workbook_template_properties, "WorkbookTemplate") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookTemplateError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[_models.WorkbookTemplateUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Default value is None. - :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Default value is None. - :type workbook_template_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[ - Union[_models.WorkbookTemplateUpdateParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Is either a WorkbookTemplateUpdateParameters type or a IO[bytes] type. - Default value is None. - :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateUpdateParameters or - IO[bytes] - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if workbook_template_update_parameters else None - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if workbook_template_update_parameters else None - _json = None - _content = None - if isinstance(workbook_template_update_parameters, (IOBase, bytes)): - _content = workbook_template_update_parameters - else: - if workbook_template_update_parameters is not None: - _json = self._serialize.body(workbook_template_update_parameters, "WorkbookTemplateUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookTemplateError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/__init__.py deleted file mode 100644 index 9bfd87c9013b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - WorkbookTemplate, - WorkbookTemplateError, - WorkbookTemplateErrorBody, - WorkbookTemplateErrorFieldContract, - WorkbookTemplateGallery, - WorkbookTemplateLocalizedGallery, - WorkbookTemplateResource, - WorkbookTemplateUpdateParameters, - WorkbookTemplatesListResult, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbookTemplate", - "WorkbookTemplateError", - "WorkbookTemplateErrorBody", - "WorkbookTemplateErrorFieldContract", - "WorkbookTemplateGallery", - "WorkbookTemplateLocalizedGallery", - "WorkbookTemplateResource", - "WorkbookTemplateUpdateParameters", - "WorkbookTemplatesListResult", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_models_py3.py deleted file mode 100644 index dc08eeb5f3b0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_models_py3.py +++ /dev/null @@ -1,430 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from collections.abc import MutableMapping -from typing import Any, Optional, TYPE_CHECKING - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class WorkbookTemplateResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class WorkbookTemplate(WorkbookTemplateResource): - """An Application Insights workbook template definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :vartype priority: int - :ivar author: Information about the author of the workbook template. - :vartype author: str - :ivar template_data: Valid JSON object containing workbook template payload. - :vartype template_data: JSON - :ivar galleries: Workbook galleries supported by the template. - :vartype galleries: - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] - :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages - supported by the Azure portal. - :vartype localized: dict[str, - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateLocalizedGallery]] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "priority": {"key": "properties.priority", "type": "int"}, - "author": {"key": "properties.author", "type": "str"}, - "template_data": {"key": "properties.templateData", "type": "object"}, - "galleries": {"key": "properties.galleries", "type": "[WorkbookTemplateGallery]"}, - "localized": {"key": "properties.localized", "type": "{[WorkbookTemplateLocalizedGallery]}"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - priority: Optional[int] = None, - author: Optional[str] = None, - template_data: Optional[JSON] = None, - galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, - localized: Optional[dict[str, list["_models.WorkbookTemplateLocalizedGallery"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :paramtype priority: int - :keyword author: Information about the author of the workbook template. - :paramtype author: str - :keyword template_data: Valid JSON object containing workbook template payload. - :paramtype template_data: JSON - :keyword galleries: Workbook galleries supported by the template. - :paramtype galleries: - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] - :keyword localized: Key value pair of localized gallery. Each key is the locale code of - languages supported by the Azure portal. - :paramtype localized: dict[str, - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateLocalizedGallery]] - """ - super().__init__(location=location, tags=tags, **kwargs) - self.priority = priority - self.author = author - self.template_data = template_data - self.galleries = galleries - self.localized = localized - - -class WorkbookTemplateError(_serialization.Model): - """Error message that will indicate why the operation failed. - - :ivar error: Error message object that will indicate why the operation failed. - :vartype error: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateErrorBody - """ - - _attribute_map = { - "error": {"key": "error", "type": "WorkbookTemplateErrorBody"}, - } - - def __init__(self, *, error: Optional["_models.WorkbookTemplateErrorBody"] = None, **kwargs: Any) -> None: - """ - :keyword error: Error message object that will indicate why the operation failed. - :paramtype error: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateErrorBody - """ - super().__init__(**kwargs) - self.error = error - - -class WorkbookTemplateErrorBody(_serialization.Model): - """Error message body that will indicate why the operation failed. - - :ivar code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :vartype code: str - :ivar message: Human-readable representation of the error. - :vartype message: str - :ivar details: The list of invalid fields send in request, in case of validation error. - :vartype details: - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateErrorFieldContract] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "details": {"key": "details", "type": "[WorkbookTemplateErrorFieldContract]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - details: Optional[list["_models.WorkbookTemplateErrorFieldContract"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: Service-defined error code. This code serves as a sub-status for the HTTP error - code specified in the response. - :paramtype code: str - :keyword message: Human-readable representation of the error. - :paramtype message: str - :keyword details: The list of invalid fields send in request, in case of validation error. - :paramtype details: - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateErrorFieldContract] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.details = details - - -class WorkbookTemplateErrorFieldContract(_serialization.Model): - """Error Field contract. - - :ivar code: Property level error code. - :vartype code: str - :ivar message: Human-readable representation of property-level error. - :vartype message: str - :ivar target: Property name. - :vartype target: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - } - - def __init__( - self, *, code: Optional[str] = None, message: Optional[str] = None, target: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword code: Property level error code. - :paramtype code: str - :keyword message: Human-readable representation of property-level error. - :paramtype message: str - :keyword target: Property name. - :paramtype target: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - - -class WorkbookTemplateGallery(_serialization.Model): - """Gallery information for a workbook template. - - :ivar name: Name of the workbook template in the gallery. - :vartype name: str - :ivar category: Category for the gallery. - :vartype category: str - :ivar type: Type of workbook supported by the workbook template. - :vartype type: str - :ivar order: Order of the template within the gallery. - :vartype order: int - :ivar resource_type: Azure resource type supported by the gallery. - :vartype resource_type: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "category": {"key": "category", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "order": {"key": "order", "type": "int"}, - "resource_type": {"key": "resourceType", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - category: Optional[str] = None, - type: Optional[str] = None, - order: Optional[int] = None, - resource_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the workbook template in the gallery. - :paramtype name: str - :keyword category: Category for the gallery. - :paramtype category: str - :keyword type: Type of workbook supported by the workbook template. - :paramtype type: str - :keyword order: Order of the template within the gallery. - :paramtype order: int - :keyword resource_type: Azure resource type supported by the gallery. - :paramtype resource_type: str - """ - super().__init__(**kwargs) - self.name = name - self.category = category - self.type = type - self.order = order - self.resource_type = resource_type - - -class WorkbookTemplateLocalizedGallery(_serialization.Model): - """Localized template data and gallery information. - - :ivar template_data: Valid JSON object containing workbook template payload. - :vartype template_data: JSON - :ivar galleries: Workbook galleries supported by the template. - :vartype galleries: - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] - """ - - _attribute_map = { - "template_data": {"key": "templateData", "type": "object"}, - "galleries": {"key": "galleries", "type": "[WorkbookTemplateGallery]"}, - } - - def __init__( - self, - *, - template_data: Optional[JSON] = None, - galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword template_data: Valid JSON object containing workbook template payload. - :paramtype template_data: JSON - :keyword galleries: Workbook galleries supported by the template. - :paramtype galleries: - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] - """ - super().__init__(**kwargs) - self.template_data = template_data - self.galleries = galleries - - -class WorkbookTemplatesListResult(_serialization.Model): - """WorkbookTemplate list result. - - :ivar value: An array of workbook templates. - :vartype value: list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[WorkbookTemplate]"}, - } - - def __init__(self, *, value: Optional[list["_models.WorkbookTemplate"]] = None, **kwargs: Any) -> None: - """ - :keyword value: An array of workbook templates. - :paramtype value: list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate] - """ - super().__init__(**kwargs) - self.value = value - - -class WorkbookTemplateUpdateParameters(_serialization.Model): - """The parameters that can be provided when updating workbook template. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :vartype priority: int - :ivar author: Information about the author of the workbook template. - :vartype author: str - :ivar template_data: Valid JSON object containing workbook template payload. - :vartype template_data: JSON - :ivar galleries: Workbook galleries supported by the template. - :vartype galleries: - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] - :ivar localized: Key value pair of localized gallery. Each key is the locale code of languages - supported by the Azure portal. - :vartype localized: dict[str, - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateLocalizedGallery]] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "priority": {"key": "properties.priority", "type": "int"}, - "author": {"key": "properties.author", "type": "str"}, - "template_data": {"key": "properties.templateData", "type": "object"}, - "galleries": {"key": "properties.galleries", "type": "[WorkbookTemplateGallery]"}, - "localized": {"key": "properties.localized", "type": "{[WorkbookTemplateLocalizedGallery]}"}, - } - - def __init__( - self, - *, - tags: Optional[dict[str, str]] = None, - priority: Optional[int] = None, - author: Optional[str] = None, - template_data: Optional[JSON] = None, - galleries: Optional[list["_models.WorkbookTemplateGallery"]] = None, - localized: Optional[dict[str, list["_models.WorkbookTemplateLocalizedGallery"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword priority: Priority of the template. Determines which template to open when a workbook - gallery is opened in viewer mode. - :paramtype priority: int - :keyword author: Information about the author of the workbook template. - :paramtype author: str - :keyword template_data: Valid JSON object containing workbook template payload. - :paramtype template_data: JSON - :keyword galleries: Workbook galleries supported by the template. - :paramtype galleries: - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateGallery] - :keyword localized: Key value pair of localized gallery. Each key is the locale code of - languages supported by the Azure portal. - :paramtype localized: dict[str, - list[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateLocalizedGallery]] - """ - super().__init__(**kwargs) - self.tags = tags - self.priority = priority - self.author = author - self.template_data = template_data - self.galleries = galleries - self.localized = localized diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/__init__.py deleted file mode 100644 index aa730bc20e57..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._workbook_templates_operations import WorkbookTemplatesOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbookTemplatesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_workbook_templates_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_workbook_templates_operations.py deleted file mode 100644 index 88728d9e31f8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/operations/_workbook_templates_operations.py +++ /dev/null @@ -1,709 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -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_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-11-20")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates", - ) - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2020-11-20")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2020-11-20")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, 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", "2020-11-20")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, 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", "2020-11-20")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooktemplates/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class WorkbookTemplatesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2020_11_20.ApplicationInsightsManagementClient`'s - :attr:`workbook_templates` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.WorkbookTemplate"]: - """Get all Workbook templates defined within a specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WorkbookTemplate or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbookTemplatesListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbookTemplatesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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.WorkbookTemplateError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.WorkbookTemplate: - """Get a single workbook template by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookTemplateError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Delete a workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookTemplateError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: _models.WorkbookTemplate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Required. - :type workbook_template_properties: - ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Required. - :type workbook_template_properties: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_properties: Union[_models.WorkbookTemplate, IO[bytes]], - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Create a new workbook template. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_properties: Properties that need to be specified to create a new - workbook. Is either a WorkbookTemplate type or a IO[bytes] type. Required. - :type workbook_template_properties: - ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate or IO[bytes] - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_template_properties, (IOBase, bytes)): - _content = workbook_template_properties - else: - _json = self._serialize.body(workbook_template_properties, "WorkbookTemplate") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookTemplateError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[_models.WorkbookTemplateUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Default value is None. - :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Default value is None. - :type workbook_template_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_template_update_parameters: Optional[ - Union[_models.WorkbookTemplateUpdateParameters, IO[bytes]] - ] = None, - **kwargs: Any - ) -> _models.WorkbookTemplate: - """Updates a workbook template that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_template_update_parameters: Properties that need to be specified to patch a - workbook template. Is either a WorkbookTemplateUpdateParameters type or a IO[bytes] type. - Default value is None. - :type workbook_template_update_parameters: - ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplateUpdateParameters or - IO[bytes] - :return: WorkbookTemplate or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2020_11_20.models.WorkbookTemplate - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if workbook_template_update_parameters else None - cls: ClsType[_models.WorkbookTemplate] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if workbook_template_update_parameters else None - _json = None - _content = None - if isinstance(workbook_template_update_parameters, (IOBase, bytes)): - _content = workbook_template_update_parameters - else: - if workbook_template_update_parameters is not None: - _json = self._serialize.body(workbook_template_update_parameters, "WorkbookTemplateUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookTemplateError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WorkbookTemplate", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2020_11_20/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_application_insights_management_client.py deleted file mode 100644 index fc49f70ba967..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_application_insights_management_client.py +++ /dev/null @@ -1,128 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import MyWorkbooksOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar my_workbooks: MyWorkbooksOperations operations - :vartype my_workbooks: - azure.mgmt.applicationinsights.v2021_03_08.operations.MyWorkbooksOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-03-08". 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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.my_workbooks = MyWorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_configuration.py deleted file mode 100644 index 64dc84eb047d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-03-08". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2021-03-08") - - 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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_application_insights_management_client.py deleted file mode 100644 index fda965eba0a2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_application_insights_management_client.py +++ /dev/null @@ -1,132 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import MyWorkbooksOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar my_workbooks: MyWorkbooksOperations operations - :vartype my_workbooks: - azure.mgmt.applicationinsights.v2021_03_08.aio.operations.MyWorkbooksOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-03-08". 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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.my_workbooks = MyWorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_configuration.py deleted file mode 100644 index 0ed7231f6616..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-03-08". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2021-03-08") - - 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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/__init__.py deleted file mode 100644 index 05ffdf9526ba..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._my_workbooks_operations import MyWorkbooksOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "MyWorkbooksOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_my_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_my_workbooks_operations.py deleted file mode 100644 index 1a026fb87964..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_my_workbooks_operations.py +++ /dev/null @@ -1,683 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._my_workbooks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class MyWorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2021_03_08.aio.ApplicationInsightsManagementClient`'s - :attr:`my_workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.MyWorkbook"]: - """Get all private workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either MyWorkbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - source_id=source_id, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MyWorkbooksListResult", 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.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription( - self, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.MyWorkbook"]: - """Get all private workbooks defined within a specified subscription and category. - - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either MyWorkbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MyWorkbooksListResult", 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.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.MyWorkbook: - """Get a single private workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Delete a private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.MyWorkbook, - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.MyWorkbook, IO[bytes]], - source_id: Optional[str] = None, - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook or - IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "MyWorkbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.MyWorkbook, - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.MyWorkbook, IO[bytes]], - source_id: Optional[str] = None, - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook or - IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "MyWorkbook") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/__init__.py deleted file mode 100644 index 7ff21bf3e6ae..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/__init__.py +++ /dev/null @@ -1,54 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ErrorDefinition, - InnerErrorTrace, - MyWorkbook, - MyWorkbookError, - MyWorkbookManagedIdentity, - MyWorkbookResource, - MyWorkbookUserAssignedIdentities, - MyWorkbooksListResult, - SystemData, -) - -from ._application_insights_management_client_enums import ( # type: ignore - CategoryType, - CreatedByType, - Kind, - MyWorkbookManagedIdentityType, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ErrorDefinition", - "InnerErrorTrace", - "MyWorkbook", - "MyWorkbookError", - "MyWorkbookManagedIdentity", - "MyWorkbookResource", - "MyWorkbookUserAssignedIdentities", - "MyWorkbooksListResult", - "SystemData", - "CategoryType", - "CreatedByType", - "Kind", - "MyWorkbookManagedIdentityType", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_application_insights_management_client_enums.py deleted file mode 100644 index b5b139725464..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_application_insights_management_client_enums.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """CategoryType.""" - - WORKBOOK = "workbook" - TSG = "TSG" - PERFORMANCE = "performance" - RETENTION = "retention" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of workbook. Choices are user and shared.""" - - USER = "user" - SHARED = "shared" - - -class MyWorkbookManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The identity type.""" - - USER_ASSIGNED = "UserAssigned" - NONE = "None" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_models_py3.py deleted file mode 100644 index 093f47a17013..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_models_py3.py +++ /dev/null @@ -1,469 +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. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class ErrorDefinition(_serialization.Model): - """Error definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Service specific error code which serves as the substatus for the HTTP error code. - :vartype code: str - :ivar message: Description of the error. - :vartype message: str - :ivar innererror: Internal error details. - :vartype innererror: any - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "innererror": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "innererror": {"key": "innererror", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.innererror: Optional[Any] = None - - -class InnerErrorTrace(_serialization.Model): - """Error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar trace: detailed error trace. - :vartype trace: list[str] - """ - - _validation = { - "trace": {"readonly": True}, - } - - _attribute_map = { - "trace": {"key": "trace", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.trace: Optional[list[str]] = None - - -class MyWorkbookResource(_serialization.Model): - """An azure resource object. - - :ivar identity: Identity used for BYOS. - :vartype identity: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentity - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar etag: Resource etag. - :vartype etag: dict[str, str] - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "MyWorkbookManagedIdentity"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "etag": {"key": "etag", "type": "{str}"}, - } - - def __init__( - self, - *, - identity: Optional["_models.MyWorkbookManagedIdentity"] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - etag: Optional[dict[str, str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: Identity used for BYOS. - :paramtype identity: - ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentity - :keyword id: Azure resource Id. - :paramtype id: str - :keyword name: Azure resource name. - :paramtype name: str - :keyword type: Azure resource type. - :paramtype type: str - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword etag: Resource etag. - :paramtype etag: dict[str, str] - """ - super().__init__(**kwargs) - self.identity = identity - self.id = id - self.name = name - self.type = type - self.location = location - self.tags = tags - self.etag = etag - - -class MyWorkbook(MyWorkbookResource): - """An Application Insights private workbook definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar identity: Identity used for BYOS. - :vartype identity: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentity - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar etag: Resource etag. - :vartype etag: dict[str, str] - :ivar kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.Kind - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.applicationinsights.v2021_03_08.models.SystemData - :ivar display_name: The user-defined name of the private workbook. - :vartype display_name: str - :ivar serialized_data: Configuration of this particular private workbook. Configuration data is - a string containing valid JSON. - :vartype serialized_data: str - :ivar version: This instance's version of the data model. This can change as new features are - added that can be marked private workbook. - :vartype version: str - :ivar time_modified: Date and time in UTC of the last modification that was made to this - private workbook definition. - :vartype time_modified: str - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar tags_properties_tags: A list of 0 or more tags that are associated with this private - workbook definition. - :vartype tags_properties_tags: list[str] - :ivar user_id: Unique user id of the specific user that owns this private workbook. - :vartype user_id: str - :ivar source_id: Optional resourceId for a source resource. - :vartype source_id: str - :ivar storage_uri: BYOS Storage Account URI. - :vartype storage_uri: str - """ - - _validation = { - "system_data": {"readonly": True}, - "time_modified": {"readonly": True}, - "user_id": {"readonly": True}, - } - - _attribute_map = { - "identity": {"key": "identity", "type": "MyWorkbookManagedIdentity"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "etag": {"key": "etag", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "time_modified": {"key": "properties.timeModified", "type": "str"}, - "category": {"key": "properties.category", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - "user_id": {"key": "properties.userId", "type": "str"}, - "source_id": {"key": "properties.sourceId", "type": "str"}, - "storage_uri": {"key": "properties.storageUri", "type": "str"}, - } - - def __init__( - self, - *, - identity: Optional["_models.MyWorkbookManagedIdentity"] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - etag: Optional[dict[str, str]] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - display_name: Optional[str] = None, - serialized_data: Optional[str] = None, - version: Optional[str] = None, - category: Optional[str] = None, - tags_properties_tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - storage_uri: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: Identity used for BYOS. - :paramtype identity: - ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentity - :keyword id: Azure resource Id. - :paramtype id: str - :keyword name: Azure resource name. - :paramtype name: str - :keyword type: Azure resource type. - :paramtype type: str - :keyword location: Resource location. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword etag: Resource etag. - :paramtype etag: dict[str, str] - :keyword kind: The kind of workbook. Choices are user and shared. Known values are: "user" and - "shared". - :paramtype kind: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.Kind - :keyword display_name: The user-defined name of the private workbook. - :paramtype display_name: str - :keyword serialized_data: Configuration of this particular private workbook. Configuration data - is a string containing valid JSON. - :paramtype serialized_data: str - :keyword version: This instance's version of the data model. This can change as new features - are added that can be marked private workbook. - :paramtype version: str - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword tags_properties_tags: A list of 0 or more tags that are associated with this private - workbook definition. - :paramtype tags_properties_tags: list[str] - :keyword source_id: Optional resourceId for a source resource. - :paramtype source_id: str - :keyword storage_uri: BYOS Storage Account URI. - :paramtype storage_uri: str - """ - super().__init__( - identity=identity, id=id, name=name, type=type, location=location, tags=tags, etag=etag, **kwargs - ) - self.kind = kind - self.system_data: Optional["_models.SystemData"] = None - self.display_name = display_name - self.serialized_data = serialized_data - self.version = version - self.time_modified: Optional[str] = None - self.category = category - self.tags_properties_tags = tags_properties_tags - self.user_id: Optional[str] = None - self.source_id = source_id - self.storage_uri = storage_uri - - -class MyWorkbookError(_serialization.Model): - """Error response. - - :ivar error: The error details. - :vartype error: ~azure.mgmt.applicationinsights.v2021_03_08.models.ErrorDefinition - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDefinition"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDefinition"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error details. - :paramtype error: ~azure.mgmt.applicationinsights.v2021_03_08.models.ErrorDefinition - """ - super().__init__(**kwargs) - self.error = error - - -class MyWorkbookManagedIdentity(_serialization.Model): - """Customer Managed Identity. - - :ivar user_assigned_identities: Customer Managed Identity. - :vartype user_assigned_identities: - ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookUserAssignedIdentities - :ivar type: The identity type. Known values are: "UserAssigned" and "None". - :vartype type: str or - ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentityType - """ - - _attribute_map = { - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "MyWorkbookUserAssignedIdentities"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - user_assigned_identities: Optional["_models.MyWorkbookUserAssignedIdentities"] = None, - type: Optional[Union[str, "_models.MyWorkbookManagedIdentityType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword user_assigned_identities: Customer Managed Identity. - :paramtype user_assigned_identities: - ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookUserAssignedIdentities - :keyword type: The identity type. Known values are: "UserAssigned" and "None". - :paramtype type: str or - ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbookManagedIdentityType - """ - super().__init__(**kwargs) - self.user_assigned_identities = user_assigned_identities - self.type = type - - -class MyWorkbooksListResult(_serialization.Model): - """Workbook list result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: An array of private workbooks. - :vartype value: list[~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook] - :ivar next_link: - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[MyWorkbook]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value: Optional[list["_models.MyWorkbook"]] = None - self.next_link = next_link - - -class MyWorkbookUserAssignedIdentities(_serialization.Model): - """Customer Managed Identity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.applicationinsights.v2021_03_08.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.applicationinsights.v2021_03_08.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.applicationinsights.v2021_03_08.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.applicationinsights.v2021_03_08.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 diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/__init__.py deleted file mode 100644 index 05ffdf9526ba..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._my_workbooks_operations import MyWorkbooksOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "MyWorkbooksOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_my_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_my_workbooks_operations.py deleted file mode 100644 index 35841e2f3bf9..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_my_workbooks_operations.py +++ /dev/null @@ -1,912 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -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_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks", - ) - 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["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - if source_id is not None: - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - _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_subscription_request( - subscription_id: str, - *, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks") - 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["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, 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", "2021-03-08")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2021-03-08")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - source_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if source_id is not None: - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - source_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-03-08")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if source_id is not None: - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -class MyWorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2021_03_08.ApplicationInsightsManagementClient`'s - :attr:`my_workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.MyWorkbook"]: - """Get all private workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either MyWorkbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - source_id=source_id, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MyWorkbooksListResult", 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.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription( - self, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.MyWorkbook"]: - """Get all private workbooks defined within a specified subscription and category. - - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2021_03_08.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either MyWorkbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MyWorkbooksListResult", 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.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.MyWorkbook: - """Get a single private workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Delete a private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.MyWorkbook, - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.MyWorkbook, IO[bytes]], - source_id: Optional[str] = None, - **kwargs: Any - ) -> _models.MyWorkbook: - """Create a new private workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook or - IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "MyWorkbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.MyWorkbook, - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Required. - :type workbook_properties: IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.MyWorkbook, IO[bytes]], - source_id: Optional[str] = None, - **kwargs: Any - ) -> _models.MyWorkbook: - """Updates a private workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new private - workbook. Is either a MyWorkbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook or - IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :return: MyWorkbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_03_08.models.MyWorkbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MyWorkbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "MyWorkbook") - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.MyWorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MyWorkbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_03_08/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_application_insights_management_client.py deleted file mode 100644 index aea35925c5d6..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_application_insights_management_client.py +++ /dev/null @@ -1,127 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import WorkbooksOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar workbooks: WorkbooksOperations operations - :vartype workbooks: azure.mgmt.applicationinsights.v2021_08_01.operations.WorkbooksOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-08-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_configuration.py deleted file mode 100644 index acd975d365fc..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-08-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2021-08-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_application_insights_management_client.py deleted file mode 100644 index 30fb977e68a0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_application_insights_management_client.py +++ /dev/null @@ -1,132 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import WorkbooksOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar workbooks: WorkbooksOperations operations - :vartype workbooks: - azure.mgmt.applicationinsights.v2021_08_01.aio.operations.WorkbooksOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-08-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_configuration.py deleted file mode 100644 index f3c38bf2bf3d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-08-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2021-08-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/__init__.py deleted file mode 100644 index 244af54256b7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._workbooks_operations import WorkbooksOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbooksOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_workbooks_operations.py deleted file mode 100644 index 2603125e7a39..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/aio/operations/_workbooks_operations.py +++ /dev/null @@ -1,849 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._workbooks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_revision_get_request, - build_revisions_list_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class WorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2021_08_01.aio.ApplicationInsightsManagementClient`'s - :attr:`workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified subscription and category. - - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - source_id=source_id, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, can_fetch_content: Optional[bool] = None, **kwargs: Any - ) -> _models.Workbook: - """Get a single workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Delete a workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.Workbook, - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.Workbook, IO[bytes]], - source_id: Optional[str] = None, - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. Is - either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook or - IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "Workbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookUpdateParameters or IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if workbook_update_parameters else None - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if workbook_update_parameters else None - _json = None - _content = None - if isinstance(workbook_update_parameters, (IOBase, bytes)): - _content = workbook_update_parameters - else: - if workbook_update_parameters is not None: - _json = self._serialize.body(workbook_update_parameters, "WorkbookUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def revisions_list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Workbook"]: - """Get the revisions for the workbook defined by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_revisions_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def revision_get( - self, resource_group_name: str, resource_name: str, revision_id: str, **kwargs: Any - ) -> _models.Workbook: - """Get a single workbook revision defined by its revisionId. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param revision_id: The id of the workbook's revision. Required. - :type revision_id: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_revision_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - revision_id=revision_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/__init__.py deleted file mode 100644 index 68da5baea7a6..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/__init__.py +++ /dev/null @@ -1,64 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ManagedServiceIdentity, - Resource, - SystemData, - TrackedResource, - UserAssignedIdentity, - Workbook, - WorkbookError, - WorkbookErrorDefinition, - WorkbookInnerErrorTrace, - WorkbookResource, - WorkbookResourceIdentity, - WorkbookUpdateParameters, - WorkbooksListResult, -) - -from ._application_insights_management_client_enums import ( # type: ignore - CategoryType, - CreatedByType, - Kind, - ManagedServiceIdentityType, - SharedTypeKind, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ManagedServiceIdentity", - "Resource", - "SystemData", - "TrackedResource", - "UserAssignedIdentity", - "Workbook", - "WorkbookError", - "WorkbookErrorDefinition", - "WorkbookInnerErrorTrace", - "WorkbookResource", - "WorkbookResourceIdentity", - "WorkbookUpdateParameters", - "WorkbooksListResult", - "CategoryType", - "CreatedByType", - "Kind", - "ManagedServiceIdentityType", - "SharedTypeKind", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_application_insights_management_client_enums.py deleted file mode 100644 index e774a1a1297a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_application_insights_management_client_enums.py +++ /dev/null @@ -1,53 +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 CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """CategoryType.""" - - WORKBOOK = "workbook" - TSG = "TSG" - PERFORMANCE = "performance" - RETENTION = "retention" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class Kind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of workbook. Only valid value is shared.""" - - USER = "user" - SHARED = "shared" - - -class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (where both SystemAssigned and UserAssigned types are - allowed). - """ - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class SharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of workbook. Only valid value is shared.""" - - USER = "user" - SHARED = "shared" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_models_py3.py deleted file mode 100644 index 380140c5d29a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_models_py3.py +++ /dev/null @@ -1,706 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or - ~azure.mgmt.applicationinsights.v2021_08_01.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.applicationinsights.v2021_08_01.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :paramtype type: str or - ~azure.mgmt.applicationinsights.v2021_08_01.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.applicationinsights.v2021_08_01.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -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: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.applicationinsights.v2021_08_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.applicationinsights.v2021_08_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.applicationinsights.v2021_08_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.applicationinsights.v2021_08_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 TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.client_id: Optional[str] = None - - -class WorkbookResource(TrackedResource): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Identity used for BYOS. - :vartype identity: ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookResourceIdentity - :ivar kind: The kind of workbook. Only valid value is shared. Known values are: "user" and - "shared". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.Kind - :ivar etag: Resource etag. - :vartype etag: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "WorkbookResourceIdentity"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.WorkbookResourceIdentity"] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - etag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Identity used for BYOS. - :paramtype identity: - ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookResourceIdentity - :keyword kind: The kind of workbook. Only valid value is shared. Known values are: "user" and - "shared". - :paramtype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.Kind - :keyword etag: Resource etag. - :paramtype etag: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.kind = kind - self.etag = etag - - -class Workbook(WorkbookResource): - """An Application Insights workbook definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Identity used for BYOS. - :vartype identity: ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookResourceIdentity - :ivar kind: The kind of workbook. Only valid value is shared. Known values are: "user" and - "shared". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.Kind - :ivar etag: Resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.applicationinsights.v2021_08_01.models.SystemData - :ivar display_name: The user-defined name (display name) of the workbook. - :vartype display_name: str - :ivar serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :vartype serialized_data: str - :ivar version: Workbook schema version format, like 'Notebook/1.0', which should match the - workbook in serializedData. - :vartype version: str - :ivar time_modified: Date and time in UTC of the last modification that was made to this - workbook definition. - :vartype time_modified: ~datetime.datetime - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar tags_properties_tags: Being deprecated, please use the other tags field. - :vartype tags_properties_tags: list[str] - :ivar user_id: Unique user id of the specific user that owns this workbook. - :vartype user_id: str - :ivar source_id: ResourceId for a source resource. - :vartype source_id: str - :ivar storage_uri: The resourceId to the storage account when bring your own storage is used. - :vartype storage_uri: str - :ivar description: The description of the workbook. - :vartype description: str - :ivar revision: The unique revision id for this workbook definition. - :vartype revision: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "time_modified": {"readonly": True}, - "user_id": {"readonly": True}, - "revision": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "WorkbookResourceIdentity"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "time_modified": {"key": "properties.timeModified", "type": "iso-8601"}, - "category": {"key": "properties.category", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - "user_id": {"key": "properties.userId", "type": "str"}, - "source_id": {"key": "properties.sourceId", "type": "str"}, - "storage_uri": {"key": "properties.storageUri", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "revision": {"key": "properties.revision", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.WorkbookResourceIdentity"] = None, - kind: Optional[Union[str, "_models.Kind"]] = None, - etag: Optional[str] = None, - display_name: Optional[str] = None, - serialized_data: Optional[str] = None, - version: Optional[str] = None, - category: Optional[str] = None, - tags_properties_tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - storage_uri: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Identity used for BYOS. - :paramtype identity: - ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookResourceIdentity - :keyword kind: The kind of workbook. Only valid value is shared. Known values are: "user" and - "shared". - :paramtype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.Kind - :keyword etag: Resource etag. - :paramtype etag: str - :keyword display_name: The user-defined name (display name) of the workbook. - :paramtype display_name: str - :keyword serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :paramtype serialized_data: str - :keyword version: Workbook schema version format, like 'Notebook/1.0', which should match the - workbook in serializedData. - :paramtype version: str - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword tags_properties_tags: Being deprecated, please use the other tags field. - :paramtype tags_properties_tags: list[str] - :keyword source_id: ResourceId for a source resource. - :paramtype source_id: str - :keyword storage_uri: The resourceId to the storage account when bring your own storage is - used. - :paramtype storage_uri: str - :keyword description: The description of the workbook. - :paramtype description: str - """ - super().__init__(tags=tags, location=location, identity=identity, kind=kind, etag=etag, **kwargs) - self.system_data: Optional["_models.SystemData"] = None - self.display_name = display_name - self.serialized_data = serialized_data - self.version = version - self.time_modified: Optional[datetime.datetime] = None - self.category = category - self.tags_properties_tags = tags_properties_tags - self.user_id: Optional[str] = None - self.source_id = source_id - self.storage_uri = storage_uri - self.description = description - self.revision: Optional[str] = None - - -class WorkbookError(_serialization.Model): - """Error response. - - :ivar error: The error details. - :vartype error: ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookErrorDefinition - """ - - _attribute_map = { - "error": {"key": "error", "type": "WorkbookErrorDefinition"}, - } - - def __init__(self, *, error: Optional["_models.WorkbookErrorDefinition"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error details. - :paramtype error: ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookErrorDefinition - """ - super().__init__(**kwargs) - self.error = error - - -class WorkbookErrorDefinition(_serialization.Model): - """Error definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Service specific error code which serves as the substatus for the HTTP error code. - :vartype code: str - :ivar message: Description of the error. - :vartype message: str - :ivar innererror: Internal error details. - :vartype innererror: ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookInnerErrorTrace - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "innererror": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "innererror": {"key": "innererror", "type": "WorkbookInnerErrorTrace"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.innererror: Optional["_models.WorkbookInnerErrorTrace"] = None - - -class WorkbookInnerErrorTrace(_serialization.Model): - """Error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar trace: detailed error trace. - :vartype trace: list[str] - """ - - _validation = { - "trace": {"readonly": True}, - } - - _attribute_map = { - "trace": {"key": "trace", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.trace: Optional[list[str]] = None - - -class WorkbookResourceIdentity(ManagedServiceIdentity): - """Identity used for BYOS. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or - ~azure.mgmt.applicationinsights.v2021_08_01.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.applicationinsights.v2021_08_01.models.UserAssignedIdentity] - """ - - -class WorkbooksListResult(_serialization.Model): - """Workbook list result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: An array of workbooks. - :vartype value: list[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] - :ivar next_link: - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Workbook]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value: Optional[list["_models.Workbook"]] = None - self.next_link = next_link - - -class WorkbookUpdateParameters(_serialization.Model): - """The parameters that can be provided when updating workbook properties properties. - - :ivar kind: The kind of workbook. Only valid value is shared. Known values are: "user" and - "shared". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.SharedTypeKind - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar display_name: The user-defined name (display name) of the workbook. - :vartype display_name: str - :ivar serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :vartype serialized_data: str - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :vartype tags_properties_tags: list[str] - :ivar description: The description of the workbook. - :vartype description: str - :ivar revision: The unique revision id for this workbook definition. - :vartype revision: str - """ - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "category": {"key": "properties.category", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - "description": {"key": "properties.description", "type": "str"}, - "revision": {"key": "properties.revision", "type": "str"}, - } - - def __init__( - self, - *, - kind: Optional[Union[str, "_models.SharedTypeKind"]] = None, - tags: Optional[dict[str, str]] = None, - display_name: Optional[str] = None, - serialized_data: Optional[str] = None, - category: Optional[str] = None, - tags_properties_tags: Optional[list[str]] = None, - description: Optional[str] = None, - revision: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword kind: The kind of workbook. Only valid value is shared. Known values are: "user" and - "shared". - :paramtype kind: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.SharedTypeKind - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword display_name: The user-defined name (display name) of the workbook. - :paramtype display_name: str - :keyword serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :paramtype serialized_data: str - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :paramtype tags_properties_tags: list[str] - :keyword description: The description of the workbook. - :paramtype description: str - :keyword revision: The unique revision id for this workbook definition. - :paramtype revision: str - """ - super().__init__(**kwargs) - self.kind = kind - self.tags = tags - self.display_name = display_name - self.serialized_data = serialized_data - self.category = category - self.tags_properties_tags = tags_properties_tags - self.description = description - self.revision = revision diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/__init__.py deleted file mode 100644 index 244af54256b7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._workbooks_operations import WorkbooksOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbooksOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_workbooks_operations.py deleted file mode 100644 index dc40b653fb8b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/operations/_workbooks_operations.py +++ /dev/null @@ -1,1152 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, - *, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/workbooks") - 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["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks", - ) - 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["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - if source_id is not None: - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2021-08-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - source_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if source_id is not None: - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - source_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if source_id is not None: - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_revisions_list_request( - resource_group_name: str, 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", "2021-08-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_revision_get_request( - resource_group_name: str, resource_name: str, revision_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-08-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions/{revisionId}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "revisionId": _SERIALIZER.url("revision_id", revision_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class WorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2021_08_01.ApplicationInsightsManagementClient`'s - :attr:`workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified subscription and category. - - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2021_08_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - source_id=source_id, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, can_fetch_content: Optional[bool] = None, **kwargs: Any - ) -> _models.Workbook: - """Get a single workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Delete a workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.Workbook, - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.Workbook, IO[bytes]], - source_id: Optional[str] = None, - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. Is - either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook or - IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "Workbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2021_08_01.models.WorkbookUpdateParameters or IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if workbook_update_parameters else None - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if workbook_update_parameters else None - _json = None - _content = None - if isinstance(workbook_update_parameters, (IOBase, bytes)): - _content = workbook_update_parameters - else: - if workbook_update_parameters is not None: - _json = self._serialize.body(workbook_update_parameters, "WorkbookUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def revisions_list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> ItemPaged["_models.Workbook"]: - """Get the revisions for the workbook defined by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_revisions_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def revision_get( - self, resource_group_name: str, resource_name: str, revision_id: str, **kwargs: Any - ) -> _models.Workbook: - """Get a single workbook revision defined by its revisionId. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the Application Insights component resource. Required. - :type resource_name: str - :param revision_id: The id of the workbook's revision. Required. - :type revision_id: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_08_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_revision_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - revision_id=revision_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_08_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_application_insights_management_client.py deleted file mode 100644 index 8570ad8e8bdc..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_application_insights_management_client.py +++ /dev/null @@ -1,120 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import LiveTokenOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar live_token: LiveTokenOperations operations - :vartype live_token: azure.mgmt.applicationinsights.v2021_10.operations.LiveTokenOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-10-14". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - base_url: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_configuration.py deleted file mode 100644 index b86ae0570284..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-10-14". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, credential: "TokenCredential", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2021-10-14") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.credential = credential - self.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_application_insights_management_client.py deleted file mode 100644 index a03d33837d17..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_application_insights_management_client.py +++ /dev/null @@ -1,124 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import LiveTokenOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar live_token: LiveTokenOperations operations - :vartype live_token: azure.mgmt.applicationinsights.v2021_10.aio.operations.LiveTokenOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-10-14". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - base_url: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.live_token = LiveTokenOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_configuration.py deleted file mode 100644 index a5e4c12cc189..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2021-10-14". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, credential: "AsyncTokenCredential", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2021-10-14") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - - self.credential = credential - self.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/__init__.py deleted file mode 100644 index 46b276948dcf..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._live_token_operations import LiveTokenOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "LiveTokenOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_live_token_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_live_token_operations.py deleted file mode 100644 index d99d8f7dd6d3..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_live_token_operations.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import AsyncPipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._live_token_operations import build_get_request -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class LiveTokenOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2021_10.aio.ApplicationInsightsManagementClient`'s - :attr:`live_token` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: - """**Gets an access token for live metrics stream data.**. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :return: LiveTokenResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_10.models.LiveTokenResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_uri=resource_uri, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LiveTokenResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/__init__.py deleted file mode 100644 index 04eb8d951dbb..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/__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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ErrorResponseLinkedStorage, - ErrorResponseLinkedStorageError, - LiveTokenResponse, - OperationInfo, - OperationLive, - OperationsListResult, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ErrorResponseLinkedStorage", - "ErrorResponseLinkedStorageError", - "LiveTokenResponse", - "OperationInfo", - "OperationLive", - "OperationsListResult", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_models_py3.py deleted file mode 100644 index a81c0b863e03..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_models_py3.py +++ /dev/null @@ -1,218 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from collections.abc import MutableMapping -from typing import Any, Optional, TYPE_CHECKING - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class ErrorResponseLinkedStorage(_serialization.Model): - """ErrorResponseLinkedStorage. - - :ivar error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :vartype error: ~azure.mgmt.applicationinsights.v2021_10.models.ErrorResponseLinkedStorageError - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorResponseLinkedStorageError"}, - } - - def __init__(self, *, error: Optional["_models.ErrorResponseLinkedStorageError"] = None, **kwargs: Any) -> None: - """ - :keyword error: Error response indicates Insights service is not able to process the incoming - request. The reason is provided in the error message. - :paramtype error: - ~azure.mgmt.applicationinsights.v2021_10.models.ErrorResponseLinkedStorageError - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorResponseLinkedStorageError(_serialization.Model): - """Error response indicates Insights service is not able to process the incoming request. The - reason is provided in the error message. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message indicating why the operation failed. - :vartype message: str - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - - -class LiveTokenResponse(_serialization.Model): - """The response to a live token query. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar live_token: JWT token for accessing live metrics stream data. - :vartype live_token: str - """ - - _validation = { - "live_token": {"readonly": True}, - } - - _attribute_map = { - "live_token": {"key": "liveToken", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.live_token: Optional[str] = None - - -class OperationInfo(_serialization.Model): - """Information about an operation. - - :ivar provider: Name of the provider. - :vartype provider: str - :ivar resource: Name of the resource type. - :vartype resource: str - :ivar operation: Name of the operation. - :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: Name of the provider. - :paramtype provider: str - :keyword resource: Name of the resource type. - :paramtype resource: str - :keyword operation: Name of the operation. - :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 OperationLive(_serialization.Model): - """Represents an operation returned by the GetOperations request. - - :ivar name: Name of the operation. - :vartype name: str - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool - :ivar display: Display name of the operation. - :vartype display: ~azure.mgmt.applicationinsights.v2021_10.models.OperationInfo - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: JSON - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationInfo"}, - "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "object"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.OperationInfo"] = None, - origin: Optional[str] = None, - properties: Optional[JSON] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the operation. - :paramtype name: str - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool - :keyword display: Display name of the operation. - :paramtype display: ~azure.mgmt.applicationinsights.v2021_10.models.OperationInfo - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: JSON - """ - super().__init__(**kwargs) - self.name = name - self.is_data_action = is_data_action - self.display = display - self.origin = origin - self.properties = properties - - -class OperationsListResult(_serialization.Model): - """Result of the List Operations operation. - - :ivar value: A collection of operations. - :vartype value: list[~azure.mgmt.applicationinsights.v2021_10.models.OperationLive] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[OperationLive]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.OperationLive"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: A collection of operations. - :paramtype value: list[~azure.mgmt.applicationinsights.v2021_10.models.OperationLive] - :keyword next_link: URL to get the next set of operation list results if there are any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/__init__.py deleted file mode 100644 index 46b276948dcf..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._live_token_operations import LiveTokenOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "LiveTokenOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_live_token_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_live_token_operations.py deleted file mode 100644 index d584dc57efd1..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_live_token_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-10-14")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceUri}/providers/Microsoft.Insights/generatelivetoken") - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class LiveTokenOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2021_10.ApplicationInsightsManagementClient`'s - :attr:`live_token` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_uri: str, **kwargs: Any) -> _models.LiveTokenResponse: - """**Gets an access token for live metrics stream data.**. - - :param resource_uri: The identifier of the resource. Required. - :type resource_uri: str - :return: LiveTokenResponse or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2021_10.models.LiveTokenResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LiveTokenResponse] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_uri=resource_uri, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponseLinkedStorage, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LiveTokenResponse", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2021_10/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_application_insights_management_client.py deleted file mode 100644 index 825d054bf86a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_application_insights_management_client.py +++ /dev/null @@ -1,127 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import WorkbooksOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar workbooks: WorkbooksOperations operations - :vartype workbooks: azure.mgmt.applicationinsights.v2022_04_01.operations.WorkbooksOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2022-04-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_configuration.py deleted file mode 100644 index 01a4dfcba07a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2022-04-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_application_insights_management_client.py deleted file mode 100644 index a85a8096fcc4..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_application_insights_management_client.py +++ /dev/null @@ -1,132 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import WorkbooksOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar workbooks: WorkbooksOperations operations - :vartype workbooks: - azure.mgmt.applicationinsights.v2022_04_01.aio.operations.WorkbooksOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2022-04-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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.workbooks = WorkbooksOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_configuration.py deleted file mode 100644 index 8e0fcc46bd21..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2022-04-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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/__init__.py deleted file mode 100644 index 244af54256b7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._workbooks_operations import WorkbooksOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbooksOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_workbooks_operations.py deleted file mode 100644 index c12b5c3b3927..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/aio/operations/_workbooks_operations.py +++ /dev/null @@ -1,849 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._workbooks_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_revision_get_request, - build_revisions_list_request, - build_update_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] - - -class WorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2022_04_01.aio.ApplicationInsightsManagementClient`'s - :attr:`workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified subscription and category. - - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - source_id=source_id, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, resource_name: str, can_fetch_content: Optional[bool] = None, **kwargs: Any - ) -> _models.Workbook: - """Get a single workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> None: - """Delete a workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.Workbook, - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.Workbook, IO[bytes]], - source_id: Optional[str] = None, - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. Is - either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook or - IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "Workbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateParameters or IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if workbook_update_parameters else None - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if workbook_update_parameters else None - _json = None - _content = None - if isinstance(workbook_update_parameters, (IOBase, bytes)): - _content = workbook_update_parameters - else: - if workbook_update_parameters is not None: - _json = self._serialize.body(workbook_update_parameters, "WorkbookUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def revisions_list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Workbook"]: - """Get the revisions for the workbook defined by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_revisions_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def revision_get( - self, resource_group_name: str, resource_name: str, revision_id: str, **kwargs: Any - ) -> _models.Workbook: - """Get a single workbook revision defined by its revisionId. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param revision_id: The id of the workbook's revision. Required. - :type revision_id: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_revision_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - revision_id=revision_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/__init__.py deleted file mode 100644 index 3ef7aa01aafc..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/__init__.py +++ /dev/null @@ -1,64 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - ManagedServiceIdentity, - Resource, - SystemData, - TrackedResource, - UserAssignedIdentity, - Workbook, - WorkbookError, - WorkbookErrorDefinition, - WorkbookInnerErrorTrace, - WorkbookResource, - WorkbookResourceIdentity, - WorkbookUpdateParameters, - WorkbooksListResult, -) - -from ._application_insights_management_client_enums import ( # type: ignore - CategoryType, - CreatedByType, - ManagedServiceIdentityType, - WorkbookSharedTypeKind, - WorkbookUpdateSharedTypeKind, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ManagedServiceIdentity", - "Resource", - "SystemData", - "TrackedResource", - "UserAssignedIdentity", - "Workbook", - "WorkbookError", - "WorkbookErrorDefinition", - "WorkbookInnerErrorTrace", - "WorkbookResource", - "WorkbookResourceIdentity", - "WorkbookUpdateParameters", - "WorkbooksListResult", - "CategoryType", - "CreatedByType", - "ManagedServiceIdentityType", - "WorkbookSharedTypeKind", - "WorkbookUpdateSharedTypeKind", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_application_insights_management_client_enums.py deleted file mode 100644 index b927dae90683..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_application_insights_management_client_enums.py +++ /dev/null @@ -1,51 +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 CategoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """CategoryType.""" - - WORKBOOK = "workbook" - TSG = "TSG" - PERFORMANCE = "performance" - RETENTION = "retention" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (where both SystemAssigned and UserAssigned types are - allowed). - """ - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - - -class WorkbookSharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of workbook. Only valid value is shared.""" - - SHARED = "shared" - - -class WorkbookUpdateSharedTypeKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of workbook. Only valid value is shared.""" - - SHARED = "shared" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_models_py3.py deleted file mode 100644 index 08cb129a99de..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_models_py3.py +++ /dev/null @@ -1,704 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or - ~azure.mgmt.applicationinsights.v2022_04_01.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.applicationinsights.v2022_04_01.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :paramtype type: str or - ~azure.mgmt.applicationinsights.v2022_04_01.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.applicationinsights.v2022_04_01.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -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: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.applicationinsights.v2022_04_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.applicationinsights.v2022_04_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.applicationinsights.v2022_04_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.applicationinsights.v2022_04_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 TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.client_id: Optional[str] = None - - -class WorkbookResource(TrackedResource): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Identity used for BYOS. - :vartype identity: ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookResourceIdentity - :ivar kind: The kind of workbook. Only valid value is shared. "shared" - :vartype kind: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookSharedTypeKind - :ivar etag: Resource etag. - :vartype etag: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "WorkbookResourceIdentity"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.WorkbookResourceIdentity"] = None, - kind: Optional[Union[str, "_models.WorkbookSharedTypeKind"]] = None, - etag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Identity used for BYOS. - :paramtype identity: - ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookResourceIdentity - :keyword kind: The kind of workbook. Only valid value is shared. "shared" - :paramtype kind: str or - ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookSharedTypeKind - :keyword etag: Resource etag. - :paramtype etag: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.kind = kind - self.etag = etag - - -class Workbook(WorkbookResource): - """A workbook definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. 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 tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Identity used for BYOS. - :vartype identity: ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookResourceIdentity - :ivar kind: The kind of workbook. Only valid value is shared. "shared" - :vartype kind: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookSharedTypeKind - :ivar etag: Resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.applicationinsights.v2022_04_01.models.SystemData - :ivar display_name: The user-defined name (display name) of the workbook. - :vartype display_name: str - :ivar serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :vartype serialized_data: str - :ivar version: Workbook schema version format, like 'Notebook/1.0', which should match the - workbook in serializedData. - :vartype version: str - :ivar time_modified: Date and time in UTC of the last modification that was made to this - workbook definition. - :vartype time_modified: ~datetime.datetime - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar tags_properties_tags: Being deprecated, please use the other tags field. - :vartype tags_properties_tags: list[str] - :ivar user_id: Unique user id of the specific user that owns this workbook. - :vartype user_id: str - :ivar source_id: ResourceId for a source resource. - :vartype source_id: str - :ivar storage_uri: The resourceId to the storage account when bring your own storage is used. - :vartype storage_uri: str - :ivar description: The description of the workbook. - :vartype description: str - :ivar revision: The unique revision id for this workbook definition. - :vartype revision: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - "time_modified": {"readonly": True}, - "user_id": {"readonly": True}, - "revision": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "identity": {"key": "identity", "type": "WorkbookResourceIdentity"}, - "kind": {"key": "kind", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "time_modified": {"key": "properties.timeModified", "type": "iso-8601"}, - "category": {"key": "properties.category", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - "user_id": {"key": "properties.userId", "type": "str"}, - "source_id": {"key": "properties.sourceId", "type": "str"}, - "storage_uri": {"key": "properties.storageUri", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "revision": {"key": "properties.revision", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.WorkbookResourceIdentity"] = None, - kind: Optional[Union[str, "_models.WorkbookSharedTypeKind"]] = None, - etag: Optional[str] = None, - display_name: Optional[str] = None, - serialized_data: Optional[str] = None, - version: Optional[str] = None, - category: Optional[str] = None, - tags_properties_tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - storage_uri: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Identity used for BYOS. - :paramtype identity: - ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookResourceIdentity - :keyword kind: The kind of workbook. Only valid value is shared. "shared" - :paramtype kind: str or - ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookSharedTypeKind - :keyword etag: Resource etag. - :paramtype etag: str - :keyword display_name: The user-defined name (display name) of the workbook. - :paramtype display_name: str - :keyword serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :paramtype serialized_data: str - :keyword version: Workbook schema version format, like 'Notebook/1.0', which should match the - workbook in serializedData. - :paramtype version: str - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword tags_properties_tags: Being deprecated, please use the other tags field. - :paramtype tags_properties_tags: list[str] - :keyword source_id: ResourceId for a source resource. - :paramtype source_id: str - :keyword storage_uri: The resourceId to the storage account when bring your own storage is - used. - :paramtype storage_uri: str - :keyword description: The description of the workbook. - :paramtype description: str - """ - super().__init__(tags=tags, location=location, identity=identity, kind=kind, etag=etag, **kwargs) - self.system_data: Optional["_models.SystemData"] = None - self.display_name = display_name - self.serialized_data = serialized_data - self.version = version - self.time_modified: Optional[datetime.datetime] = None - self.category = category - self.tags_properties_tags = tags_properties_tags - self.user_id: Optional[str] = None - self.source_id = source_id - self.storage_uri = storage_uri - self.description = description - self.revision: Optional[str] = None - - -class WorkbookError(_serialization.Model): - """Error response. - - :ivar error: The error details. - :vartype error: ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookErrorDefinition - """ - - _attribute_map = { - "error": {"key": "error", "type": "WorkbookErrorDefinition"}, - } - - def __init__(self, *, error: Optional["_models.WorkbookErrorDefinition"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error details. - :paramtype error: ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookErrorDefinition - """ - super().__init__(**kwargs) - self.error = error - - -class WorkbookErrorDefinition(_serialization.Model): - """Error definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Service specific error code which serves as the substatus for the HTTP error code. - :vartype code: str - :ivar message: Description of the error. - :vartype message: str - :ivar innererror: Internal error details. - :vartype innererror: ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookInnerErrorTrace - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "innererror": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "innererror": {"key": "innererror", "type": "WorkbookInnerErrorTrace"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.innererror: Optional["_models.WorkbookInnerErrorTrace"] = None - - -class WorkbookInnerErrorTrace(_serialization.Model): - """Error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar trace: detailed error trace. - :vartype trace: list[str] - """ - - _validation = { - "trace": {"readonly": True}, - } - - _attribute_map = { - "trace": {"key": "trace", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.trace: Optional[list[str]] = None - - -class WorkbookResourceIdentity(ManagedServiceIdentity): - """Identity used for BYOS. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or - ~azure.mgmt.applicationinsights.v2022_04_01.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.applicationinsights.v2022_04_01.models.UserAssignedIdentity] - """ - - -class WorkbooksListResult(_serialization.Model): - """Workbook list result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: An array of workbooks. - :vartype value: list[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] - :ivar next_link: - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Workbook]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value: Optional[list["_models.Workbook"]] = None - self.next_link = next_link - - -class WorkbookUpdateParameters(_serialization.Model): - """The parameters that can be provided when updating workbook properties properties. - - :ivar kind: The kind of workbook. Only valid value is shared. "shared" - :vartype kind: str or - ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateSharedTypeKind - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar display_name: The user-defined name (display name) of the workbook. - :vartype display_name: str - :ivar serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :vartype serialized_data: str - :ivar category: Workbook category, as defined by the user at creation time. - :vartype category: str - :ivar tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :vartype tags_properties_tags: list[str] - :ivar description: The description of the workbook. - :vartype description: str - :ivar revision: The unique revision id for this workbook definition. - :vartype revision: str - """ - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "serialized_data": {"key": "properties.serializedData", "type": "str"}, - "category": {"key": "properties.category", "type": "str"}, - "tags_properties_tags": {"key": "properties.tags", "type": "[str]"}, - "description": {"key": "properties.description", "type": "str"}, - "revision": {"key": "properties.revision", "type": "str"}, - } - - def __init__( - self, - *, - kind: Optional[Union[str, "_models.WorkbookUpdateSharedTypeKind"]] = None, - tags: Optional[dict[str, str]] = None, - display_name: Optional[str] = None, - serialized_data: Optional[str] = None, - category: Optional[str] = None, - tags_properties_tags: Optional[list[str]] = None, - description: Optional[str] = None, - revision: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword kind: The kind of workbook. Only valid value is shared. "shared" - :paramtype kind: str or - ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateSharedTypeKind - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword display_name: The user-defined name (display name) of the workbook. - :paramtype display_name: str - :keyword serialized_data: Configuration of this particular workbook. Configuration data is a - string containing valid JSON. - :paramtype serialized_data: str - :keyword category: Workbook category, as defined by the user at creation time. - :paramtype category: str - :keyword tags_properties_tags: A list of 0 or more tags that are associated with this workbook - definition. - :paramtype tags_properties_tags: list[str] - :keyword description: The description of the workbook. - :paramtype description: str - :keyword revision: The unique revision id for this workbook definition. - :paramtype revision: str - """ - super().__init__(**kwargs) - self.kind = kind - self.tags = tags - self.display_name = display_name - self.serialized_data = serialized_data - self.category = category - self.tags_properties_tags = tags_properties_tags - self.description = description - self.revision = revision diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/__init__.py deleted file mode 100644 index 244af54256b7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._workbooks_operations import WorkbooksOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WorkbooksOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_workbooks_operations.py deleted file mode 100644 index 0198a232e7fa..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/operations/_workbooks_operations.py +++ /dev/null @@ -1,1152 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request( - subscription_id: str, - *, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/workbooks") - 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["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, - subscription_id: str, - *, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks", - ) - 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["category"] = _SERIALIZER.query("category", category, "str") - if tags is not None: - _params["tags"] = _SERIALIZER.query("tags", tags, "[str]", div=",") - if source_id is not None: - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - can_fetch_content: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if can_fetch_content is not None: - _params["canFetchContent"] = _SERIALIZER.query("can_fetch_content", can_fetch_content, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, 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", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - source_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if source_id is not None: - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - resource_name: str, - subscription_id: str, - *, - source_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if source_id is not None: - _params["sourceId"] = _SERIALIZER.query("source_id", source_id, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_revisions_list_request( - resource_group_name: str, 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", "2022-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_revision_get_request( - resource_group_name: str, resource_name: str, revision_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-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/workbooks/{resourceName}/revisions/{revisionId}", - ) - 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 - ), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "revisionId": _SERIALIZER.url("revision_id", revision_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class WorkbooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2022_04_01.ApplicationInsightsManagementClient`'s - :attr:`workbooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_subscription( - self, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified subscription and category. - - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - category: Union[str, _models.CategoryType], - tags: Optional[list[str]] = None, - source_id: Optional[str] = None, - can_fetch_content: Optional[bool] = None, - **kwargs: Any - ) -> ItemPaged["_models.Workbook"]: - """Get all Workbooks defined within a specified resource group and category. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param category: Category of workbook to return. Known values are: "workbook", "TSG", - "performance", and "retention". Required. - :type category: str or ~azure.mgmt.applicationinsights.v2022_04_01.models.CategoryType - :param tags: Tags presents on each workbook returned. Default value is None. - :type tags: list[str] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - category=category, - tags=tags, - source_id=source_id, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, resource_name: str, can_fetch_content: Optional[bool] = None, **kwargs: Any - ) -> _models.Workbook: - """Get a single workbook by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param can_fetch_content: Flag indicating whether or not to return the full content for each - applicable workbook. If false, only return summary content for workbooks. Default value is - None. - :type can_fetch_content: bool - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - can_fetch_content=can_fetch_content, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> None: - """Delete a workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: _models.Workbook, - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: IO[bytes], - source_id: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. - Required. - :type workbook_properties: IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - resource_name: str, - workbook_properties: Union[_models.Workbook, IO[bytes]], - source_id: Optional[str] = None, - **kwargs: Any - ) -> _models.Workbook: - """Create a new workbook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param workbook_properties: Properties that need to be specified to create a new workbook. Is - either a Workbook type or a IO[bytes] type. Required. - :type workbook_properties: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook or - IO[bytes] - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(workbook_properties, (IOBase, bytes)): - _content = workbook_properties - else: - _json = self._serialize.body(workbook_properties, "Workbook") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[_models.WorkbookUpdateParameters] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Default value is None. - :type workbook_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - resource_name: str, - source_id: Optional[str] = None, - workbook_update_parameters: Optional[Union[_models.WorkbookUpdateParameters, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Workbook: - """Updates a workbook that has already been added. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param source_id: Azure Resource Id that will fetch all linked workbooks. Default value is - None. - :type source_id: str - :param workbook_update_parameters: Properties that need to be specified to create a new - workbook. Is either a WorkbookUpdateParameters type or a IO[bytes] type. Default value is None. - :type workbook_update_parameters: - ~azure.mgmt.applicationinsights.v2022_04_01.models.WorkbookUpdateParameters or IO[bytes] - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - content_type = content_type if workbook_update_parameters else None - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" if workbook_update_parameters else None - _json = None - _content = None - if isinstance(workbook_update_parameters, (IOBase, bytes)): - _content = workbook_update_parameters - else: - if workbook_update_parameters is not None: - _json = self._serialize.body(workbook_update_parameters, "WorkbookUpdateParameters") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - source_id=source_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def revisions_list( - self, resource_group_name: str, resource_name: str, **kwargs: Any - ) -> ItemPaged["_models.Workbook"]: - """Get the revisions for the workbook defined by its resourceName. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :return: An iterator like instance of either Workbook or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkbooksListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_revisions_list_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkbooksListResult", 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.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def revision_get( - self, resource_group_name: str, resource_name: str, revision_id: str, **kwargs: Any - ) -> _models.Workbook: - """Get a single workbook revision defined by its revisionId. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param resource_name: The name of the resource. Required. - :type resource_name: str - :param revision_id: The id of the workbook's revision. Required. - :type revision_id: str - :return: Workbook or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_04_01.models.Workbook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workbook] = kwargs.pop("cls", None) - - _request = build_revision_get_request( - resource_group_name=resource_group_name, - resource_name=resource_name, - revision_id=revision_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.WorkbookError, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Workbook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_04_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/__init__.py deleted file mode 100644 index da2ffef86618..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/__init__.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_application_insights_management_client.py deleted file mode 100644 index 9a6611593429..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_application_insights_management_client.py +++ /dev/null @@ -1,127 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.settings import settings -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from . import models as _models -from ._configuration import ApplicationInsightsManagementClientConfiguration -from ._utils.serialization import Deserializer, Serializer -from .operations import WebTestsOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar web_tests: WebTestsOperations operations - :vartype web_tests: azure.mgmt.applicationinsights.v2022_06_15.operations.WebTestsOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2022-06-15". 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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, 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.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_configuration.py deleted file mode 100644 index 90176abc4620..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials import TokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2022-06-15". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2022-06-15") - - 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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/__init__.py deleted file mode 100644 index 0af9b28f6607..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/__init__.py +++ /dev/null @@ -1,6 +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. -# -------------------------------------------------------------------------- diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/serialization.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/serialization.py deleted file mode 100644 index 6da830e0cf4a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_utils/serialization.py +++ /dev/null @@ -1,2041 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -# pyright: reportUnnecessaryTypeIgnoreComment=false - -from base64 import b64decode, b64encode -import calendar -import datetime -import decimal -import email -from enum import Enum -import json -import logging -import re -import sys -import codecs -from typing import ( - Any, - cast, - Optional, - Union, - AnyStr, - IO, - Mapping, - Callable, - MutableMapping, -) - -try: - from urllib import quote # type: ignore -except ImportError: - from urllib.parse import quote -import xml.etree.ElementTree as ET - -import isodate # type: ignore -from typing_extensions import Self - -from azure.core.exceptions import DeserializationError, SerializationError -from azure.core.serialization import NULL as CoreNull - -_BOM = codecs.BOM_UTF8.decode(encoding="utf-8") - -JSON = MutableMapping[str, Any] - - -class RawDeserializer: - - # Accept "text" because we're open minded people... - JSON_REGEXP = re.compile(r"^(application|text)/([a-z+.]+\+)?json$") - - # Name used in context - CONTEXT_NAME = "deserialized_data" - - @classmethod - def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: - """Decode data according to content-type. - - Accept a stream of data as well, but will be load at once in memory for now. - - If no content-type, will return the string version (not bytes, not stream) - - :param data: Input, could be bytes or stream (will be decoded with UTF8) or text - :type data: str or bytes or IO - :param str content_type: The content type. - :return: The deserialized data. - :rtype: object - """ - if hasattr(data, "read"): - # Assume a stream - data = cast(IO, data).read() - - if isinstance(data, bytes): - data_as_str = data.decode(encoding="utf-8-sig") - else: - # Explain to mypy the correct type. - data_as_str = cast(str, data) - - # Remove Byte Order Mark if present in string - data_as_str = data_as_str.lstrip(_BOM) - - if content_type is None: - return data - - if cls.JSON_REGEXP.match(content_type): - try: - return json.loads(data_as_str) - except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) from err - elif "xml" in (content_type or []): - try: - - try: - if isinstance(data, unicode): # type: ignore - # If I'm Python 2.7 and unicode XML will scream if I try a "fromstring" on unicode string - data_as_str = data_as_str.encode(encoding="utf-8") # type: ignore - except NameError: - pass - - return ET.fromstring(data_as_str) # nosec - except ET.ParseError as err: - # It might be because the server has an issue, and returned JSON with - # content-type XML.... - # So let's try a JSON load, and if it's still broken - # let's flow the initial exception - def _json_attemp(data): - try: - return True, json.loads(data) - except ValueError: - return False, None # Don't care about this one - - success, json_result = _json_attemp(data) - if success: - return json_result - # If i'm here, it's not JSON, it's not XML, let's scream - # and raise the last context in this block (the XML exception) - # The function hack is because Py2.7 messes up with exception - # context otherwise. - _LOGGER.critical("Wasn't XML not JSON, failing") - raise DeserializationError("XML is invalid") from err - elif content_type.startswith("text/"): - return data_as_str - raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) - - @classmethod - def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: - """Deserialize from HTTP response. - - Use bytes and headers to NOT use any requests/aiohttp or whatever - specific implementation. - Headers will tested for "content-type" - - :param bytes body_bytes: The body of the response. - :param dict headers: The headers of the response. - :returns: The deserialized data. - :rtype: object - """ - # Try to use content-type from headers if available - content_type = None - if "content-type" in headers: - content_type = headers["content-type"].split(";")[0].strip().lower() - # Ouch, this server did not declare what it sent... - # Let's guess it's JSON... - # Also, since Autorest was considering that an empty body was a valid JSON, - # need that test as well.... - else: - content_type = "application/json" - - if body_bytes: - return cls.deserialize_from_text(body_bytes, content_type) - return None - - -_LOGGER = logging.getLogger(__name__) - -try: - _long_type = long # type: ignore -except NameError: - _long_type = int - -TZ_UTC = datetime.timezone.utc - -_FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[dict[str, Any]] = {} - for k in kwargs: # pylint: disable=consider-using-dict-items - if k not in self._attribute_map: - _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) - elif k in self._validation and self._validation[k].get("readonly", False): - _LOGGER.warning("Readonly attribute %s will be ignored in class %s", k, self.__class__) - else: - setattr(self, k, kwargs[k]) - - def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are equal - :rtype: bool - """ - if isinstance(other, self.__class__): - return self.__dict__ == other.__dict__ - return False - - def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes. - - :param object other: The object to compare - :returns: True if objects are not equal - :rtype: bool - """ - return not self.__eq__(other) - - def __str__(self) -> str: - return str(self.__dict__) - - @classmethod - def enable_additional_properties_sending(cls) -> None: - cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} - - @classmethod - def is_xml_model(cls) -> bool: - try: - cls._xml_map # type: ignore - except AttributeError: - return False - return True - - @classmethod - def _create_xml_node(cls): - """Create XML node. - - :returns: The XML node - :rtype: xml.etree.ElementTree.Element - """ - try: - xml_map = cls._xml_map # type: ignore - except AttributeError: - xml_map = {} - - return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - - def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to server from this model. - - This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, keep_readonly=keep_readonly, **kwargs - ) - - def as_dict( - self, - keep_readonly: bool = True, - key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, - **kwargs: Any - ) -> JSON: - """Return a dict that can be serialized using json.dump. - - Advanced usage might optionally use a callback as parameter: - - .. code::python - - def my_key_transformer(key, attr_desc, value): - return key - - Key is the attribute name used in Python. Attr_desc - is a dict of metadata. Currently contains 'type' with the - msrest type and 'key' with the RestAPI encoded key. - Value is the current value in this object. - - The string returned will be used to serialize the key. - If the return type is a list, this is considered hierarchical - result dict. - - See the three examples in this file: - - - attribute_transformer - - full_restapi_key_transformer - - last_restapi_key_transformer - - If you want XML serialization, you can pass the kwargs is_xml=True. - - :param bool keep_readonly: If you want to serialize the readonly attributes - :param function key_transformer: A key transformer function. - :returns: A dict JSON compatible object - :rtype: dict - """ - serializer = Serializer(self._infer_class_models()) - return serializer._serialize( # type: ignore # pylint: disable=protected-access - self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs - ) - - @classmethod - def _infer_class_models(cls): - try: - str_models = cls.__module__.rsplit(".", 1)[0] - models = sys.modules[str_models] - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - if cls.__name__ not in client_models: - raise ValueError("Not Autorest generated code") - except Exception: # pylint: disable=broad-exception-caught - # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. - client_models = {cls.__name__: cls} - return client_models - - @classmethod - def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: - """Parse a str using the RestAPI syntax and return a model. - - :param str data: A str using RestAPI structure. JSON by default. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def from_dict( - cls, - data: Any, - key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, - content_type: Optional[str] = None, - ) -> Self: - """Parse a dict using given key extractor return a model. - - By default consider key - extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor - and last_rest_key_case_insensitive_extractor) - - :param dict data: A dict using RestAPI structure - :param function key_extractors: A key extractor function. - :param str content_type: JSON by default, set application/xml if XML. - :returns: An instance of this model - :raises DeserializationError: if something went wrong - :rtype: Self - """ - deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( # type: ignore - [ # type: ignore - attribute_key_case_insensitive_extractor, - rest_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - if key_extractors is None - else key_extractors - ) - return deserializer(cls.__name__, data, content_type=content_type) # type: ignore - - @classmethod - def _flatten_subtype(cls, key, objects): - if "_subtype_map" not in cls.__dict__: - return {} - result = dict(cls._subtype_map[key]) - for valuetype in cls._subtype_map[key].values(): - result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access - return result - - @classmethod - def _classify(cls, response, objects): - """Check the class _subtype_map for any child classes. - We want to ignore any inherited _subtype_maps. - - :param dict response: The initial data - :param dict objects: The class objects - :returns: The class to be used - :rtype: class - """ - for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): - subtype_value = None - - if not isinstance(response, ET.Element): - rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) - else: - subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) - if subtype_value: - # Try to match base class. Can be class name only - # (bug to fix in Autorest to support x-ms-discriminator-name) - if cls.__name__ == subtype_value: - return cls - flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) - try: - return objects[flatten_mapping_type[subtype_value]] # type: ignore - except KeyError: - _LOGGER.warning( - "Subtype value %s has no mapping, use base class %s.", - subtype_value, - cls.__name__, - ) - break - else: - _LOGGER.warning("Discriminator %s is absent or null, use base class %s.", subtype_key, cls.__name__) - break - return cls - - @classmethod - def _get_rest_key_parts(cls, attr_key): - """Get the RestAPI key of this attr, split it and decode part - :param str attr_key: Attribute key must be in attribute_map. - :returns: A list of RestAPI part - :rtype: list - """ - rest_split_key = _FLATTEN.split(cls._attribute_map[attr_key]["key"]) - return [_decode_attribute_map_key(key_part) for key_part in rest_split_key] - - -def _decode_attribute_map_key(key): - """This decode a key in an _attribute_map to the actual key we want to look at - inside the received data. - - :param str key: A key string from the generated code - :returns: The decoded key - :rtype: str - """ - return key.replace("\\.", ".") - - -class Serializer: # pylint: disable=too-many-public-methods - """Request object model serializer.""" - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - _xml_basic_types_serializers = {"bool": lambda x: str(x).lower()} - days = {0: "Mon", 1: "Tue", 2: "Wed", 3: "Thu", 4: "Fri", 5: "Sat", 6: "Sun"} - months = { - 1: "Jan", - 2: "Feb", - 3: "Mar", - 4: "Apr", - 5: "May", - 6: "Jun", - 7: "Jul", - 8: "Aug", - 9: "Sep", - 10: "Oct", - 11: "Nov", - 12: "Dec", - } - validation = { - "min_length": lambda x, y: len(x) < y, - "max_length": lambda x, y: len(x) > y, - "minimum": lambda x, y: x < y, - "maximum": lambda x, y: x > y, - "minimum_ex": lambda x, y: x <= y, - "maximum_ex": lambda x, y: x >= y, - "min_items": lambda x, y: len(x) < y, - "max_items": lambda x, y: len(x) > y, - "pattern": lambda x, y: not re.match(y, x, re.UNICODE), - "unique": lambda x, y: len(x) != len(set(x)), - "multiple": lambda x, y: x % y != 0, - } - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.serialize_type = { - "iso-8601": Serializer.serialize_iso, - "rfc-1123": Serializer.serialize_rfc, - "unix-time": Serializer.serialize_unix, - "duration": Serializer.serialize_duration, - "date": Serializer.serialize_date, - "time": Serializer.serialize_time, - "decimal": Serializer.serialize_decimal, - "long": Serializer.serialize_long, - "bytearray": Serializer.serialize_bytearray, - "base64": Serializer.serialize_base64, - "object": self.serialize_object, - "[]": self.serialize_iter, - "{}": self.serialize_dict, - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_transformer = full_restapi_key_transformer - self.client_side_validation = True - - def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals - self, target_obj, data_type=None, **kwargs - ): - """Serialize data into a string according to type. - - :param object target_obj: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, dict - :raises SerializationError: if serialization fails. - :returns: The serialized data. - """ - key_transformer = kwargs.get("key_transformer", self.key_transformer) - keep_readonly = kwargs.get("keep_readonly", False) - if target_obj is None: - return None - - attr_name = None - class_name = target_obj.__class__.__name__ - - if data_type: - return self.serialize_data(target_obj, data_type, **kwargs) - - if not hasattr(target_obj, "_attribute_map"): - data_type = type(target_obj).__name__ - if data_type in self.basic_types.values(): - return self.serialize_data(target_obj, data_type, **kwargs) - - # Force "is_xml" kwargs if we detect a XML model - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - is_xml_model_serialization = kwargs.setdefault("is_xml", target_obj.is_xml_model()) - - serialized = {} - if is_xml_model_serialization: - serialized = target_obj._create_xml_node() # pylint: disable=protected-access - try: - attributes = target_obj._attribute_map # pylint: disable=protected-access - for attr, attr_desc in attributes.items(): - attr_name = attr - if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access - attr_name, {} - ).get("readonly", False): - continue - - if attr_name == "additional_properties" and attr_desc["key"] == "": - if target_obj.additional_properties is not None: - serialized |= target_obj.additional_properties - continue - try: - - orig_attr = getattr(target_obj, attr) - if is_xml_model_serialization: - pass # Don't provide "transformer" for XML for now. Keep "orig_attr" - else: # JSON - keys, orig_attr = key_transformer(attr, attr_desc.copy(), orig_attr) - keys = keys if isinstance(keys, list) else [keys] - - kwargs["serialization_ctxt"] = attr_desc - new_attr = self.serialize_data(orig_attr, attr_desc["type"], **kwargs) - - if is_xml_model_serialization: - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - xml_prefix = xml_desc.get("prefix", None) - xml_ns = xml_desc.get("ns", None) - if xml_desc.get("attr", False): - if xml_ns: - ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) # type: ignore - continue - if xml_desc.get("text", False): - serialized.text = new_attr # type: ignore - continue - if isinstance(new_attr, list): - serialized.extend(new_attr) # type: ignore - elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, - # we MUST replace the tag with the local tag. But keeping the namespaces. - if "name" not in getattr(orig_attr, "_xml_map", {}): - splitted_tag = new_attr.tag.split("}") - if len(splitted_tag) == 2: # Namespace - new_attr.tag = "}".join([splitted_tag[0], xml_name]) - else: - new_attr.tag = xml_name - serialized.append(new_attr) # type: ignore - else: # That's a basic type - # Integrate namespace if necessary - local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = str(new_attr) - serialized.append(local_node) # type: ignore - else: # JSON - for k in reversed(keys): # type: ignore - new_attr = {k: new_attr} - - _new_attr = new_attr - _serialized = serialized - for k in keys: # type: ignore - if k not in _serialized: - _serialized.update(_new_attr) # type: ignore - _new_attr = _new_attr[k] # type: ignore - _serialized = _serialized[k] - except ValueError as err: - if isinstance(err, SerializationError): - raise - - except (AttributeError, KeyError, TypeError) as err: - msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise SerializationError(msg) from err - return serialized - - def body(self, data, data_type, **kwargs): - """Serialize data intended for a request body. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: dict - :raises SerializationError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized request body - """ - - # Just in case this is a dict - internal_data_type_str = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type_str, None) - try: - is_xml_model_serialization = kwargs["is_xml"] - except KeyError: - if internal_data_type and issubclass(internal_data_type, Model): - is_xml_model_serialization = kwargs.setdefault("is_xml", internal_data_type.is_xml_model()) - else: - is_xml_model_serialization = False - if internal_data_type and not isinstance(internal_data_type, Enum): - try: - deserializer = Deserializer(self.dependencies) - # Since it's on serialization, it's almost sure that format is not JSON REST - # We're not able to deal with additional properties for now. - deserializer.additional_properties_detection = False - if is_xml_model_serialization: - deserializer.key_extractors = [ # type: ignore - attribute_key_case_insensitive_extractor, - ] - else: - deserializer.key_extractors = [ - rest_key_case_insensitive_extractor, - attribute_key_case_insensitive_extractor, - last_rest_key_case_insensitive_extractor, - ] - data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access - except DeserializationError as err: - raise SerializationError("Unable to build a model: " + str(err)) from err - - return self._serialize(data, data_type, **kwargs) - - def url(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL path. - - :param str name: The name of the URL path parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :returns: The serialized URL path - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - """ - try: - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - - if kwargs.get("skip_quote") is True: - output = str(output) - output = output.replace("{", quote("{")).replace("}", quote("}")) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return output - - def query(self, name, data, data_type, **kwargs): - """Serialize data intended for a URL query. - - :param str name: The name of the query parameter. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str, list - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized query parameter - """ - try: - # Treat the list aside, since we don't want to encode the div separator - if data_type.startswith("["): - internal_data_type = data_type[1:-1] - do_quote = not kwargs.get("skip_quote", False) - return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) - - # Not a list, regular serialization - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - if kwargs.get("skip_quote") is True: - output = str(output) - else: - output = quote(str(output), safe="") - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def header(self, name, data, data_type, **kwargs): - """Serialize data intended for a request header. - - :param str name: The name of the header. - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :rtype: str - :raises TypeError: if serialization fails. - :raises ValueError: if data is None - :returns: The serialized header - """ - try: - if data_type in ["[str]"]: - data = ["" if d is None else d for d in data] - - output = self.serialize_data(data, data_type, **kwargs) - if data_type == "bool": - output = json.dumps(output) - except SerializationError as exc: - raise TypeError("{} must be type {}.".format(name, data_type)) from exc - return str(output) - - def serialize_data(self, data, data_type, **kwargs): - """Serialize generic data according to supplied data type. - - :param object data: The data to be serialized. - :param str data_type: The type to be serialized from. - :raises AttributeError: if required data is None. - :raises ValueError: if data is None - :raises SerializationError: if serialization fails. - :returns: The serialized data. - :rtype: str, int, float, bool, dict, list - """ - if data is None: - raise ValueError("No value for given attribute") - - try: - if data is CoreNull: - return None - if data_type in self.basic_types.values(): - return self.serialize_basic(data, data_type, **kwargs) - - if data_type in self.serialize_type: - return self.serialize_type[data_type](data, **kwargs) - - # If dependencies is empty, try with current data class - # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) - if issubclass(enum_type, Enum): - return Serializer.serialize_enum(data, enum_obj=enum_type) - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.serialize_type: - return self.serialize_type[iter_type](data, data_type[1:-1], **kwargs) - - except (ValueError, TypeError) as err: - msg = "Unable to serialize value: {!r} as type: {!r}." - raise SerializationError(msg.format(data, data_type)) from err - return self._serialize(data, **kwargs) - - @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements - custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) - if custom_serializer: - return custom_serializer - if kwargs.get("is_xml", False): - return cls._xml_basic_types_serializers.get(data_type) - - @classmethod - def serialize_basic(cls, data, data_type, **kwargs): - """Serialize basic builting data type. - Serializes objects to str, int, float or bool. - - Possible kwargs: - - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - - is_xml bool : If set, use xml_basic_types_serializers - - :param obj data: Object to be serialized. - :param str data_type: Type of object in the iterable. - :rtype: str, int, float, bool - :return: serialized object - :raises TypeError: raise if data_type is not one of str, int, float, bool. - """ - custom_serializer = cls._get_custom_serializers(data_type, **kwargs) - if custom_serializer: - return custom_serializer(data) - if data_type == "str": - return cls.serialize_unicode(data) - if data_type == "int": - return int(data) - if data_type == "float": - return float(data) - if data_type == "bool": - return bool(data) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @classmethod - def serialize_unicode(cls, data): - """Special handling for serializing unicode strings in Py2. - Encode to UTF-8 if unicode, otherwise handle as a str. - - :param str data: Object to be serialized. - :rtype: str - :return: serialized object - """ - try: # If I received an enum, return its value - return data.value - except AttributeError: - pass - - try: - if isinstance(data, unicode): # type: ignore - # Don't change it, JSON and XML ElementTree are totally able - # to serialize correctly u'' strings - return data - except NameError: - return str(data) - return str(data) - - def serialize_iter(self, data, iter_type, div=None, **kwargs): - """Serialize iterable. - - Supported kwargs: - - serialization_ctxt dict : The current entry of _attribute_map, or same format. - serialization_ctxt['type'] should be same as data_type. - - is_xml bool : If set, serialize as XML - - :param list data: Object to be serialized. - :param str iter_type: Type of object in the iterable. - :param str div: If set, this str will be used to combine the elements - in the iterable into a combined string. Default is 'None'. - Defaults to False. - :rtype: list, str - :return: serialized iterable - """ - if isinstance(data, str): - raise SerializationError("Refuse str type as a valid iter type.") - - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - is_xml = kwargs.get("is_xml", False) - - serialized = [] - for d in data: - try: - serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized.append(None) - - if kwargs.get("do_quote", False): - serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] - - if div: - serialized = ["" if s is None else str(s) for s in serialized] - serialized = div.join(serialized) - - if "xml" in serialization_ctxt or is_xml: - # XML serialization is more complicated - xml_desc = serialization_ctxt.get("xml", {}) - xml_name = xml_desc.get("name") - if not xml_name: - xml_name = serialization_ctxt["key"] - - # Create a wrap node if necessary (use the fact that Element and list have "append") - is_wrapped = xml_desc.get("wrapped", False) - node_name = xml_desc.get("itemsName", xml_name) - if is_wrapped: - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - else: - final_result = [] - # All list elements to "local_node" - for el in serialized: - if isinstance(el, ET.Element): - el_node = el - else: - el_node = _create_xml_node(node_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - if el is not None: # Otherwise it writes "None" :-p - el_node.text = str(el) - final_result.append(el_node) - return final_result - return serialized - - def serialize_dict(self, attr, dict_type, **kwargs): - """Serialize a dictionary of objects. - - :param dict attr: Object to be serialized. - :param str dict_type: Type of object in the dictionary. - :rtype: dict - :return: serialized dictionary - """ - serialization_ctxt = kwargs.get("serialization_ctxt", {}) - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError as err: - if isinstance(err, SerializationError): - raise - serialized[self.serialize_unicode(key)] = None - - if "xml" in serialization_ctxt: - # XML serialization is more complicated - xml_desc = serialization_ctxt["xml"] - xml_name = xml_desc["name"] - - final_result = _create_xml_node(xml_name, xml_desc.get("prefix", None), xml_desc.get("ns", None)) - for key, value in serialized.items(): - ET.SubElement(final_result, key).text = value - return final_result - - return serialized - - def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Serialize a generic object. - This will be handled as a dictionary. If object passed in is not - a basic type (str, int, float, dict, list) it will simply be - cast to str. - - :param dict attr: Object to be serialized. - :rtype: dict or str - :return: serialized object - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - return attr - obj_type = type(attr) - if obj_type in self.basic_types: - return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) - if obj_type is _long_type: - return self.serialize_long(attr) - if obj_type is str: - return self.serialize_unicode(attr) - if obj_type is datetime.datetime: - return self.serialize_iso(attr) - if obj_type is datetime.date: - return self.serialize_date(attr) - if obj_type is datetime.time: - return self.serialize_time(attr) - if obj_type is datetime.timedelta: - return self.serialize_duration(attr) - if obj_type is decimal.Decimal: - return self.serialize_decimal(attr) - - # If it's a model or I know this dependency, serialize as a Model - if obj_type in self.dependencies.values() or isinstance(attr, Model): - return self._serialize(attr) - - if obj_type == dict: - serialized = {} - for key, value in attr.items(): - try: - serialized[self.serialize_unicode(key)] = self.serialize_object(value, **kwargs) - except ValueError: - serialized[self.serialize_unicode(key)] = None - return serialized - - if obj_type == list: - serialized = [] - for obj in attr: - try: - serialized.append(self.serialize_object(obj, **kwargs)) - except ValueError: - pass - return serialized - return str(attr) - - @staticmethod - def serialize_enum(attr, enum_obj=None): - try: - result = attr.value - except AttributeError: - result = attr - try: - enum_obj(result) # type: ignore - return result - except ValueError as exc: - for enum_value in enum_obj: # type: ignore - if enum_value.value.lower() == str(attr).lower(): - return enum_value.value - error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) from exc - - @staticmethod - def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument - """Serialize bytearray into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - return b64encode(attr).decode() - - @staticmethod - def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument - """Serialize str into base-64 string. - - :param str attr: Object to be serialized. - :rtype: str - :return: serialized base64 - """ - encoded = b64encode(attr).decode("ascii") - return encoded.strip("=").replace("+", "-").replace("/", "_") - - @staticmethod - def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Decimal object to float. - - :param decimal attr: Object to be serialized. - :rtype: float - :return: serialized decimal - """ - return float(attr) - - @staticmethod - def serialize_long(attr, **kwargs): # pylint: disable=unused-argument - """Serialize long (Py2) or int (Py3). - - :param int attr: Object to be serialized. - :rtype: int/long - :return: serialized long - """ - return _long_type(attr) - - @staticmethod - def serialize_date(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Date object into ISO-8601 formatted string. - - :param Date attr: Object to be serialized. - :rtype: str - :return: serialized date - """ - if isinstance(attr, str): - attr = isodate.parse_date(attr) - t = "{:04}-{:02}-{:02}".format(attr.year, attr.month, attr.day) - return t - - @staticmethod - def serialize_time(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Time object into ISO-8601 formatted string. - - :param datetime.time attr: Object to be serialized. - :rtype: str - :return: serialized time - """ - if isinstance(attr, str): - attr = isodate.parse_time(attr) - t = "{:02}:{:02}:{:02}".format(attr.hour, attr.minute, attr.second) - if attr.microsecond: - t += ".{:02}".format(attr.microsecond) - return t - - @staticmethod - def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument - """Serialize TimeDelta object into ISO-8601 formatted string. - - :param TimeDelta attr: Object to be serialized. - :rtype: str - :return: serialized duration - """ - if isinstance(attr, str): - attr = isodate.parse_duration(attr) - return isodate.duration_isoformat(attr) - - @staticmethod - def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into RFC-1123 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises TypeError: if format invalid. - :return: serialized rfc - """ - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - except AttributeError as exc: - raise TypeError("RFC1123 object must be valid Datetime object.") from exc - - return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( - Serializer.days[utc.tm_wday], - utc.tm_mday, - Serializer.months[utc.tm_mon], - utc.tm_year, - utc.tm_hour, - utc.tm_min, - utc.tm_sec, - ) - - @staticmethod - def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into ISO-8601 formatted string. - - :param Datetime attr: Object to be serialized. - :rtype: str - :raises SerializationError: if format invalid. - :return: serialized iso - """ - if isinstance(attr, str): - attr = isodate.parse_datetime(attr) - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - utc = attr.utctimetuple() - if utc.tm_year > 9999 or utc.tm_year < 1: - raise OverflowError("Hit max or min date") - - microseconds = str(attr.microsecond).rjust(6, "0").rstrip("0").ljust(3, "0") - if microseconds: - microseconds = "." + microseconds - date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format( - utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec - ) - return date + microseconds + "Z" - except (ValueError, OverflowError) as err: - msg = "Unable to serialize datetime object." - raise SerializationError(msg) from err - except AttributeError as err: - msg = "ISO-8601 object must be valid Datetime object." - raise TypeError(msg) from err - - @staticmethod - def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param Datetime attr: Object to be serialized. - :rtype: int - :raises SerializationError: if format invalid - :return: serialied unix - """ - if isinstance(attr, int): - return attr - try: - if not attr.tzinfo: - _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") - return int(calendar.timegm(attr.utctimetuple())) - except AttributeError as exc: - raise TypeError("Unix time object must be valid Datetime object.") from exc - - -def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - key = attr_desc["key"] - working_data = data - - while "." in key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(list[str], _FLATTEN.split(key)) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = working_data.get(working_key, data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - return working_data.get(key) - - -def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements - attr, attr_desc, data -): - key = attr_desc["key"] - working_data = data - - while "." in key: - dict_keys = _FLATTEN.split(key) - if len(dict_keys) == 1: - key = _decode_attribute_map_key(dict_keys[0]) - break - working_key = _decode_attribute_map_key(dict_keys[0]) - working_data = attribute_key_case_insensitive_extractor(working_key, None, working_data) - if working_data is None: - # If at any point while following flatten JSON path see None, it means - # that all properties under are None as well - return None - key = ".".join(dict_keys[1:]) - - if working_data: - return attribute_key_case_insensitive_extractor(key, None, working_data) - - -def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_extractor(dict_keys[-1], None, data) - - -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument - """Extract the attribute in "data" based on the last part of the JSON path key. - - This is the case insensitive version of "last_rest_key_extractor" - :param str attr: The attribute to extract - :param dict attr_desc: The attribute description - :param dict data: The data to extract from - :rtype: object - :returns: The extracted attribute - """ - key = attr_desc["key"] - dict_keys = _FLATTEN.split(key) - return attribute_key_case_insensitive_extractor(dict_keys[-1], None, data) - - -def attribute_key_extractor(attr, _, data): - return data.get(attr) - - -def attribute_key_case_insensitive_extractor(attr, _, data): - found_key = None - lower_attr = attr.lower() - for key in data: - if lower_attr == key.lower(): - found_key = key - break - - return data.get(found_key) - - -def _extract_name_from_internal_type(internal_type): - """Given an internal type XML description, extract correct XML name with namespace. - - :param dict internal_type: An model type - :rtype: tuple - :returns: A tuple XML name + namespace dict - """ - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - xml_name = internal_type_xml_map.get("name", internal_type.__name__) - xml_ns = internal_type_xml_map.get("ns", None) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - return xml_name - - -def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements - if isinstance(data, dict): - return None - - # Test if this model is XML ready first - if not isinstance(data, ET.Element): - return None - - xml_desc = attr_desc.get("xml", {}) - xml_name = xml_desc.get("name", attr_desc["key"]) - - # Look for a children - is_iter_type = attr_desc["type"].startswith("[") - is_wrapped = xml_desc.get("wrapped", False) - internal_type = attr_desc.get("internalType", None) - internal_type_xml_map = getattr(internal_type, "_xml_map", {}) - - # Integrate namespace if necessary - xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) - if xml_ns: - xml_name = "{{{}}}{}".format(xml_ns, xml_name) - - # If it's an attribute, that's simple - if xml_desc.get("attr", False): - return data.get(xml_name) - - # If it's x-ms-text, that's simple too - if xml_desc.get("text", False): - return data.text - - # Scenario where I take the local name: - # - Wrapped node - # - Internal type is an enum (considered basic types) - # - Internal type has no XML/Name node - if is_wrapped or (internal_type and (issubclass(internal_type, Enum) or "name" not in internal_type_xml_map)): - children = data.findall(xml_name) - # If internal type has a local name and it's not a list, I use that name - elif not is_iter_type and internal_type and "name" in internal_type_xml_map: - xml_name = _extract_name_from_internal_type(internal_type) - children = data.findall(xml_name) - # That's an array - else: - if internal_type: # Complex type, ignore itemsName and use the complex type name - items_name = _extract_name_from_internal_type(internal_type) - else: - items_name = xml_desc.get("itemsName", xml_name) - children = data.findall(items_name) - - if len(children) == 0: - if is_iter_type: - if is_wrapped: - return None # is_wrapped no node, we want None - return [] # not wrapped, assume empty list - return None # Assume it's not there, maybe an optional node. - - # If is_iter_type and not wrapped, return all found children - if is_iter_type: - if not is_wrapped: - return children - # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) - ) - return list(children[0]) # Might be empty list and that's ok. - - # Here it's not a itertype, we should have found one element only or empty - if len(children) > 1: - raise DeserializationError("Find several XML '{}' where it was not expected".format(xml_name)) - return children[0] - - -class Deserializer: - """Response object model deserializer. - - :param dict classes: Class type dictionary for deserializing complex types. - :ivar list key_extractors: Ordered list of extractors to be used by this deserializer. - """ - - basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - - def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: - self.deserialize_type = { - "iso-8601": Deserializer.deserialize_iso, - "rfc-1123": Deserializer.deserialize_rfc, - "unix-time": Deserializer.deserialize_unix, - "duration": Deserializer.deserialize_duration, - "date": Deserializer.deserialize_date, - "time": Deserializer.deserialize_time, - "decimal": Deserializer.deserialize_decimal, - "long": Deserializer.deserialize_long, - "bytearray": Deserializer.deserialize_bytearray, - "base64": Deserializer.deserialize_base64, - "object": self.deserialize_object, - "[]": self.deserialize_iter, - "{}": self.deserialize_dict, - } - self.deserialize_expected_types = { - "duration": (isodate.Duration, datetime.timedelta), - "iso-8601": (datetime.datetime), - } - self.dependencies: dict[str, type] = dict(classes) if classes else {} - self.key_extractors = [rest_key_extractor, xml_key_extractor] - # Additional properties only works if the "rest_key_extractor" is used to - # extract the keys. Making it to work whatever the key extractor is too much - # complicated, with no real scenario for now. - # So adding a flag to disable additional properties detection. This flag should be - # used if your expect the deserialization to NOT come from a JSON REST syntax. - # Otherwise, result are unexpected - self.additional_properties_detection = True - - def __call__(self, target_obj, response_data, content_type=None): - """Call the deserializer to process a REST response. - - :param str target_obj: Target data type to deserialize to. - :param requests.Response response_data: REST response object. - :param str content_type: Swagger "produces" if available. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - data = self._unpack_content(response_data, content_type) - return self._deserialize(target_obj, data) - - def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements - """Call the deserializer on a model. - - Data needs to be already deserialized as JSON or XML ElementTree - - :param str target_obj: Target data type to deserialize to. - :param object data: Object to deserialize. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - # This is already a model, go recursive just in case - if hasattr(data, "_attribute_map"): - constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] - try: - for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access - if attr in constants: - continue - value = getattr(data, attr) - if value is None: - continue - local_type = mapconfig["type"] - internal_data_type = local_type.strip("[]{}") - if internal_data_type not in self.dependencies or isinstance(internal_data_type, Enum): - continue - setattr(data, attr, self._deserialize(local_type, value)) - return data - except AttributeError: - return - - response, class_name = self._classify_target(target_obj, data) - - if isinstance(response, str): - return self.deserialize_data(data, response) - if isinstance(response, type) and issubclass(response, Enum): - return self.deserialize_enum(data, response) - - if data is None or data is CoreNull: - return data - try: - attributes = response._attribute_map # type: ignore # pylint: disable=protected-access - d_attrs = {} - for attr, attr_desc in attributes.items(): - # Check empty string. If it's not empty, someone has a real "additionalProperties"... - if attr == "additional_properties" and attr_desc["key"] == "": - continue - raw_value = None - # Enhance attr_desc with some dynamic data - attr_desc = attr_desc.copy() # Do a copy, do not change the real one - internal_data_type = attr_desc["type"].strip("[]{}") - if internal_data_type in self.dependencies: - attr_desc["internalType"] = self.dependencies[internal_data_type] - - for key_extractor in self.key_extractors: - found_value = key_extractor(attr, attr_desc, data) - if found_value is not None: - if raw_value is not None and raw_value != found_value: - msg = ( - "Ignoring extracted value '%s' from %s for key '%s'" - " (duplicate extraction, follow extractors order)" - ) - _LOGGER.warning(msg, found_value, key_extractor, attr) - continue - raw_value = found_value - - value = self.deserialize_data(raw_value, attr_desc["type"]) - d_attrs[attr] = value - except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name # type: ignore - raise DeserializationError(msg) from err - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) - - def _build_additional_properties(self, attribute_map, data): - if not self.additional_properties_detection: - return None - if "additional_properties" in attribute_map and attribute_map.get("additional_properties", {}).get("key") != "": - # Check empty string. If it's not empty, someone has a real "additionalProperties" - return None - if isinstance(data, ET.Element): - data = {el.tag: el.text for el in data} - - known_keys = { - _decode_attribute_map_key(_FLATTEN.split(desc["key"])[0]) - for desc in attribute_map.values() - if desc["key"] != "" - } - present_keys = set(data.keys()) - missing_keys = present_keys - known_keys - return {key: data[key] for key in missing_keys} - - def _classify_target(self, target, data): - """Check to see whether the deserialization target object can - be classified into a subclass. - Once classification has been determined, initialize object. - - :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :return: The classified target object and its class name. - :rtype: tuple - """ - if target is None: - return None, None - - if isinstance(target, str): - try: - target = self.dependencies[target] - except KeyError: - return target, target - - try: - target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access - except AttributeError: - pass # Target is not a Model, no classify - return target, target.__class__.__name__ # type: ignore - - def failsafe_deserialize(self, target_obj, data, content_type=None): - """Ignores any errors encountered in deserialization, - and falls back to not deserializing the object. Recommended - for use in error deserialization, as we want to return the - HttpResponseError to users, and not have them deal with - a deserialization error. - - :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deserialize. - :param str content_type: Swagger "produces" if available. - :return: Deserialized object. - :rtype: object - """ - try: - return self(target_obj, data, content_type=content_type) - except: # pylint: disable=bare-except - _LOGGER.debug( - "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True - ) - return None - - @staticmethod - def _unpack_content(raw_data, content_type=None): - """Extract the correct structure for deserialization. - - If raw_data is a PipelineResponse, try to extract the result of RawDeserializer. - if we can't, raise. Your Pipeline should have a RawDeserializer. - - If not a pipeline response and raw_data is bytes or string, use content-type - to decode it. If no content-type, try JSON. - - If raw_data is something else, bypass all logic and return it directly. - - :param obj raw_data: Data to be processed. - :param str content_type: How to parse if raw_data is a string/bytes. - :raises JSONDecodeError: If JSON is requested and parsing is impossible. - :raises UnicodeDecodeError: If bytes is not UTF8 - :rtype: object - :return: Unpacked content. - """ - # Assume this is enough to detect a Pipeline Response without importing it - context = getattr(raw_data, "context", {}) - if context: - if RawDeserializer.CONTEXT_NAME in context: - return context[RawDeserializer.CONTEXT_NAME] - raise ValueError("This pipeline didn't have the RawDeserializer policy; can't deserialize") - - # Assume this is enough to recognize universal_http.ClientResponse without importing it - if hasattr(raw_data, "body"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text(), raw_data.headers) - - # Assume this enough to recognize requests.Response without importing it. - if hasattr(raw_data, "_content_consumed"): - return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - - if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore - return raw_data - - def _instantiate_model(self, response, attrs, additional_properties=None): - """Instantiate a response model passing in deserialized args. - - :param Response response: The response model class. - :param dict attrs: The deserialized response attributes. - :param dict additional_properties: Additional properties to be set. - :rtype: Response - :return: The instantiated response model. - """ - if callable(response): - subtype = getattr(response, "_subtype_map", {}) - try: - readonly = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("readonly") - ] - const = [ - k - for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore - if v.get("constant") - ] - kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} - response_obj = response(**kwargs) - for attr in readonly: - setattr(response_obj, attr, attrs.get(attr)) - if additional_properties: - response_obj.additional_properties = additional_properties # type: ignore - return response_obj - except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) from err - else: - try: - for attr, value in attrs.items(): - setattr(response, attr, value) - return response - except Exception as exp: - msg = "Unable to populate response model. " - msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) from exp - - def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements - """Process data for deserialization according to data type. - - :param str data: The response string to be deserialized. - :param str data_type: The type to deserialize to. - :raises DeserializationError: if deserialization fails. - :return: Deserialized object. - :rtype: object - """ - if data is None: - return data - - try: - if not data_type: - return data - if data_type in self.basic_types.values(): - return self.deserialize_basic(data, data_type) - if data_type in self.deserialize_type: - if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): - return data - - is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment - "object", - "[]", - r"{}", - ] - if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: - return None - data_val = self.deserialize_type[data_type](data) - return data_val - - iter_type = data_type[0] + data_type[-1] - if iter_type in self.deserialize_type: - return self.deserialize_type[iter_type](data, data_type[1:-1]) - - obj_type = self.dependencies[data_type] - if issubclass(obj_type, Enum): - if isinstance(data, ET.Element): - data = data.text - return self.deserialize_enum(data, obj_type) - - except (ValueError, TypeError, AttributeError) as err: - msg = "Unable to deserialize response data." - msg += " Data: {}, {}".format(data, data_type) - raise DeserializationError(msg) from err - return self._deserialize(obj_type, data) - - def deserialize_iter(self, attr, iter_type): - """Deserialize an iterable. - - :param list attr: Iterable to be deserialized. - :param str iter_type: The type of object in the iterable. - :return: Deserialized iterable. - :rtype: list - """ - if attr is None: - return None - if isinstance(attr, ET.Element): # If I receive an element here, get the children - attr = list(attr) - if not isinstance(attr, (list, set)): - raise DeserializationError("Cannot deserialize as [{}] an object of type {}".format(iter_type, type(attr))) - return [self.deserialize_data(a, iter_type) for a in attr] - - def deserialize_dict(self, attr, dict_type): - """Deserialize a dictionary. - - :param dict/list attr: Dictionary to be deserialized. Also accepts - a list of key, value pairs. - :param str dict_type: The object type of the items in the dictionary. - :return: Deserialized dictionary. - :rtype: dict - """ - if isinstance(attr, list): - return {x["key"]: self.deserialize_data(x["value"], dict_type) for x in attr} - - if isinstance(attr, ET.Element): - # Transform value into {"Key": "value"} - attr = {el.tag: el.text for el in attr} - return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - - def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements - """Deserialize a generic object. - This will be handled as a dictionary. - - :param dict attr: Dictionary to be deserialized. - :return: Deserialized object. - :rtype: dict - :raises TypeError: if non-builtin datatype encountered. - """ - if attr is None: - return None - if isinstance(attr, ET.Element): - # Do no recurse on XML, just return the tree as-is - return attr - if isinstance(attr, str): - return self.deserialize_basic(attr, "str") - obj_type = type(attr) - if obj_type in self.basic_types: - return self.deserialize_basic(attr, self.basic_types[obj_type]) - if obj_type is _long_type: - return self.deserialize_long(attr) - - if obj_type == dict: - deserialized = {} - for key, value in attr.items(): - try: - deserialized[key] = self.deserialize_object(value, **kwargs) - except ValueError: - deserialized[key] = None - return deserialized - - if obj_type == list: - deserialized = [] - for obj in attr: - try: - deserialized.append(self.deserialize_object(obj, **kwargs)) - except ValueError: - pass - return deserialized - - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) - - def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements - """Deserialize basic builtin data type from string. - Will attempt to convert to str, int, float and bool. - This function will also accept '1', '0', 'true' and 'false' as - valid bool values. - - :param str attr: response string to be deserialized. - :param str data_type: deserialization data type. - :return: Deserialized basic type. - :rtype: str, int, float or bool - :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. - """ - # If we're here, data is supposed to be a basic type. - # If it's still an XML node, take the text - if isinstance(attr, ET.Element): - attr = attr.text - if not attr: - if data_type == "str": - # None or '', node is empty string. - return "" - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None - - if data_type == "bool": - if attr in [True, False, 1, 0]: - return bool(attr) - if isinstance(attr, str): - if attr.lower() in ["true", "1"]: - return True - if attr.lower() in ["false", "0"]: - return False - raise TypeError("Invalid boolean value: {}".format(attr)) - - if data_type == "str": - return self.deserialize_unicode(attr) - if data_type == "int": - return int(attr) - if data_type == "float": - return float(attr) - raise TypeError("Unknown basic data type: {}".format(data_type)) - - @staticmethod - def deserialize_unicode(data): - """Preserve unicode objects in Python 2, otherwise return data - as a string. - - :param str data: response string to be deserialized. - :return: Deserialized string. - :rtype: str or unicode - """ - # We might be here because we have an enum modeled as string, - # and we try to deserialize a partial dict with enum inside - if isinstance(data, Enum): - return data - - # Consider this is real string - try: - if isinstance(data, unicode): # type: ignore - return data - except NameError: - return str(data) - return str(data) - - @staticmethod - def deserialize_enum(data, enum_obj): - """Deserialize string into enum object. - - If the string is not a valid enum value it will be returned as-is - and a warning will be logged. - - :param str data: Response string to be deserialized. If this value is - None or invalid it will be returned as-is. - :param Enum enum_obj: Enum object to deserialize to. - :return: Deserialized enum object. - :rtype: Enum - """ - if isinstance(data, enum_obj) or data is None: - return data - if isinstance(data, Enum): - data = data.value - if isinstance(data, int): - # Workaround. We might consider remove it in the future. - try: - return list(enum_obj.__members__.values())[data] - except IndexError as exc: - error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) from exc - try: - return enum_obj(str(data)) - except ValueError: - for enum_value in enum_obj: - if enum_value.value.lower() == str(data).lower(): - return enum_value - # We don't fail anymore for unknown value, we deserialize as a string - _LOGGER.warning("Deserializer is not able to find %s as valid enum in %s", data, enum_obj) - return Deserializer.deserialize_unicode(data) - - @staticmethod - def deserialize_bytearray(attr): - """Deserialize string into bytearray. - - :param str attr: response string to be deserialized. - :return: Deserialized bytearray - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return bytearray(b64decode(attr)) # type: ignore - - @staticmethod - def deserialize_base64(attr): - """Deserialize base64 encoded string into string. - - :param str attr: response string to be deserialized. - :return: Deserialized base64 string - :rtype: bytearray - :raises TypeError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore - attr = attr + padding # type: ignore - encoded = attr.replace("-", "+").replace("_", "/") - return b64decode(encoded) - - @staticmethod - def deserialize_decimal(attr): - """Deserialize string into Decimal object. - - :param str attr: response string to be deserialized. - :return: Deserialized decimal - :raises DeserializationError: if string format invalid. - :rtype: decimal - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - return decimal.Decimal(str(attr)) # type: ignore - except decimal.DecimalException as err: - msg = "Invalid decimal {}".format(attr) - raise DeserializationError(msg) from err - - @staticmethod - def deserialize_long(attr): - """Deserialize string into long (Py2) or int (Py3). - - :param str attr: response string to be deserialized. - :return: Deserialized int - :rtype: long or int - :raises ValueError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - return _long_type(attr) # type: ignore - - @staticmethod - def deserialize_duration(attr): - """Deserialize ISO-8601 formatted string into TimeDelta object. - - :param str attr: response string to be deserialized. - :return: Deserialized duration - :rtype: TimeDelta - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - duration = isodate.parse_duration(attr) - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize duration object." - raise DeserializationError(msg) from err - return duration - - @staticmethod - def deserialize_date(attr): - """Deserialize ISO-8601 formatted string into Date object. - - :param str attr: response string to be deserialized. - :return: Deserialized date - :rtype: Date - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=0, defaultday=0) - - @staticmethod - def deserialize_time(attr): - """Deserialize ISO-8601 formatted string into time object. - - :param str attr: response string to be deserialized. - :return: Deserialized time - :rtype: datetime.time - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore - raise DeserializationError("Date must have only digits and -. Received: %s" % attr) - return isodate.parse_time(attr) - - @staticmethod - def deserialize_rfc(attr): - """Deserialize RFC-1123 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized RFC datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - parsed_date = email.utils.parsedate_tz(attr) # type: ignore - date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) - ) - if not date_obj.tzinfo: - date_obj = date_obj.astimezone(tz=TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to rfc datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_iso(attr): - """Deserialize ISO-8601 formatted string into Datetime object. - - :param str attr: response string to be deserialized. - :return: Deserialized ISO datetime - :rtype: Datetime - :raises DeserializationError: if string format invalid. - """ - if isinstance(attr, ET.Element): - attr = attr.text - try: - attr = attr.upper() # type: ignore - match = Deserializer.valid_date.match(attr) - if not match: - raise ValueError("Invalid datetime string: " + attr) - - check_decimal = attr.split(".") - if len(check_decimal) > 1: - decimal_str = "" - for digit in check_decimal[1]: - if digit.isdigit(): - decimal_str += digit - else: - break - if len(decimal_str) > 6: - attr = attr.replace(decimal_str, decimal_str[0:6]) - - date_obj = isodate.parse_datetime(attr) - test_utc = date_obj.utctimetuple() - if test_utc.tm_year > 9999 or test_utc.tm_year < 1: - raise OverflowError("Hit max or min date") - except (ValueError, OverflowError, AttributeError) as err: - msg = "Cannot deserialize datetime object." - raise DeserializationError(msg) from err - return date_obj - - @staticmethod - def deserialize_unix(attr): - """Serialize Datetime object into IntTime format. - This is represented as seconds. - - :param int attr: Object to be serialized. - :return: Deserialized datetime - :rtype: Datetime - :raises DeserializationError: if format invalid - """ - if isinstance(attr, ET.Element): - attr = int(attr.text) # type: ignore - try: - attr = int(attr) - date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) - except ValueError as err: - msg = "Cannot deserialize to unix datetime object." - raise DeserializationError(msg) from err - return date_obj diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_version.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_version.py deleted file mode 100644 index 8231e0bce214..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/_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 = "5.0.0b2" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/__init__.py deleted file mode 100644 index 52caca38e9e7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/__init__.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._application_insights_management_client import ApplicationInsightsManagementClient # type: ignore - -try: - from ._patch import __all__ as _patch_all - from ._patch import * -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ApplicationInsightsManagementClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore - -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_application_insights_management_client.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_application_insights_management_client.py deleted file mode 100644 index bf5c7eac9184..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_application_insights_management_client.py +++ /dev/null @@ -1,132 +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, Optional, TYPE_CHECKING, cast -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.settings import settings -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.mgmt.core.tools import get_arm_endpoints - -from .. import models as _models -from .._utils.serialization import Deserializer, Serializer -from ._configuration import ApplicationInsightsManagementClientConfiguration -from .operations import WebTestsOperations - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClient: - """Composite Swagger for Application Insights Management Client. - - :ivar web_tests: WebTestsOperations operations - :vartype web_tests: - azure.mgmt.applicationinsights.v2022_06_15.aio.operations.WebTestsOperations - :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 None. - :type base_url: str - :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :paramtype cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2022-06-15". 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: Optional[str] = None, - *, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - _cloud = cloud_setting or settings.current.azure_cloud # type: ignore - _endpoints = get_arm_endpoints(_cloud) - if not base_url: - base_url = _endpoints["resource_manager"] - credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ApplicationInsightsManagementClientConfiguration( - credential=credential, - subscription_id=subscription_id, - cloud_setting=cloud_setting, - credential_scopes=credential_scopes, - **kwargs - ) - - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, 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.web_tests = WebTestsOperations(self._client, self._config, self._serialize, self._deserialize) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_configuration.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_configuration.py deleted file mode 100644 index 3f3bbeb6f55d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_configuration.py +++ /dev/null @@ -1,75 +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, Optional, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - from azure.core import AzureClouds - from azure.core.credentials_async import AsyncTokenCredential - - -class ApplicationInsightsManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ApplicationInsightsManagementClient. - - 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 - :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is - None. - :type cloud_setting: ~azure.core.AzureClouds - :keyword api_version: Api Version. Default value is "2022-06-15". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - cloud_setting: Optional["AzureClouds"] = None, - **kwargs: Any - ) -> None: - api_version: str = kwargs.pop("api_version", "2022-06-15") - - 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.cloud_setting = cloud_setting - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-applicationinsights/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - self._configure(**kwargs) - - def _configure(self, **kwargs: Any) -> None: - self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/__init__.py deleted file mode 100644 index 87f6c44f1147..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._web_tests_operations import WebTestsOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WebTestsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_web_tests_operations.py deleted file mode 100644 index 1b5c7f0dc575..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/aio/operations/_web_tests_operations.py +++ /dev/null @@ -1,678 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._web_tests_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_component_request, - build_list_by_resource_group_request, - build_list_request, - build_update_tags_request, -) -from .._configuration import ApplicationInsightsManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WebTestsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2022_06_15.aio.ApplicationInsightsManagementClient`'s - :attr:`web_tests` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined for the specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: - """Get a specific Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: _models.WebTest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: Union[_models.WebTest, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. - Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest or - IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_definition, (IOBase, bytes)): - _content = web_test_definition - else: - _json = self._serialize.body(web_test_definition, "WebTest") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Updates the tags associated with an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to associate with the web test resource. - Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2022_06_15.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Updates the tags associated with an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to associate with the web test resource. - Required. - :type web_test_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Updates the tags associated with an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to associate with the web test resource. Is - either a TagsResource type or a IO[bytes] type. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2022_06_15.models.TagsResource or - IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_tags, (IOBase, bytes)): - _content = web_test_tags - else: - _json = self._serialize.body(web_test_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> None: - """Deletes an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.WebTest"]: - """Get all Application Insights web test definitions for the specified subscription. - - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_component( - self, component_name: str, resource_group_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined for the specified component. - - :param component_name: The name of the Application Insights component resource. Required. - :type component_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_component_request( - component_name=component_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/__init__.py deleted file mode 100644 index ade03471332c..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/__init__.py +++ /dev/null @@ -1,50 +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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - - -from ._models_py3 import ( # type: ignore - HeaderField, - TagsResource, - WebTest, - WebTestGeolocation, - WebTestListResult, - WebTestPropertiesConfiguration, - WebTestPropertiesRequest, - WebTestPropertiesValidationRules, - WebTestPropertiesValidationRulesContentValidation, - WebtestsResource, -) - -from ._application_insights_management_client_enums import ( # type: ignore - WebTestKind, -) -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "HeaderField", - "TagsResource", - "WebTest", - "WebTestGeolocation", - "WebTestListResult", - "WebTestPropertiesConfiguration", - "WebTestPropertiesRequest", - "WebTestPropertiesValidationRules", - "WebTestPropertiesValidationRulesContentValidation", - "WebtestsResource", - "WebTestKind", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_application_insights_management_client_enums.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_application_insights_management_client_enums.py deleted file mode 100644 index 7b41c98c1dab..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_application_insights_management_client_enums.py +++ /dev/null @@ -1,18 +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 WebTestKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of WebTest that this web test watches. Choices are ping, multistep and standard.""" - - PING = "ping" - MULTISTEP = "multistep" - STANDARD = "standard" diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_models_py3.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_models_py3.py deleted file mode 100644 index 3d9458d0e1bf..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_models_py3.py +++ /dev/null @@ -1,511 +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, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class HeaderField(_serialization.Model): - """A header to add to the WebTest. - - :ivar header_field_name: The name of the header. - :vartype header_field_name: str - :ivar header_field_value: The value of the header. - :vartype header_field_value: str - """ - - _attribute_map = { - "header_field_name": {"key": "key", "type": "str"}, - "header_field_value": {"key": "value", "type": "str"}, - } - - def __init__( - self, *, header_field_name: Optional[str] = None, header_field_value: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword header_field_name: The name of the header. - :paramtype header_field_name: str - :keyword header_field_value: The value of the header. - :paramtype header_field_value: str - """ - super().__init__(**kwargs) - self.header_field_name = header_field_name - self.header_field_value = header_field_value - - -class TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on a - WebTest instance. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class WebtestsResource(_serialization.Model): - """An azure resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class WebTest(WebtestsResource): - """An Application Insights WebTest definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar kind: The kind of WebTest that this web test watches. Choices are ping, multistep and - standard. Known values are: "ping", "multistep", and "standard". - :vartype kind: str or ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestKind - :ivar synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as the - Name field. - :vartype synthetic_monitor_id: str - :ivar web_test_name: User defined name if this WebTest. - :vartype web_test_name: str - :ivar description: User defined description for this WebTest. - :vartype description: str - :ivar enabled: Is the test actively being monitored. - :vartype enabled: bool - :ivar frequency: Interval in seconds between test runs for this WebTest. Default value is 300. - :vartype frequency: int - :ivar timeout: Seconds until this WebTest will timeout and fail. Default value is 30. - :vartype timeout: int - :ivar web_test_kind: The kind of web test this is, valid choices are ping, multistep and - standard. Known values are: "ping", "multistep", and "standard". - :vartype web_test_kind: str or ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestKind - :ivar retry_enabled: Allow for retries should this WebTest fail. - :vartype retry_enabled: bool - :ivar locations: A list of where to physically run the tests from to give global coverage for - accessibility of your application. - :vartype locations: list[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestGeolocation] - :ivar configuration: An XML configuration specification for a WebTest. - :vartype configuration: - ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesConfiguration - :ivar provisioning_state: Current state of this component, whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. - :vartype provisioning_state: str - :ivar request: The collection of request properties. - :vartype request: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesRequest - :ivar validation_rules: The collection of validation rule properties. - :vartype validation_rules: - ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRules - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "kind": {"key": "kind", "type": "str"}, - "synthetic_monitor_id": {"key": "properties.SyntheticMonitorId", "type": "str"}, - "web_test_name": {"key": "properties.Name", "type": "str"}, - "description": {"key": "properties.Description", "type": "str"}, - "enabled": {"key": "properties.Enabled", "type": "bool"}, - "frequency": {"key": "properties.Frequency", "type": "int"}, - "timeout": {"key": "properties.Timeout", "type": "int"}, - "web_test_kind": {"key": "properties.Kind", "type": "str"}, - "retry_enabled": {"key": "properties.RetryEnabled", "type": "bool"}, - "locations": {"key": "properties.Locations", "type": "[WebTestGeolocation]"}, - "configuration": {"key": "properties.Configuration", "type": "WebTestPropertiesConfiguration"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "request": {"key": "properties.Request", "type": "WebTestPropertiesRequest"}, - "validation_rules": {"key": "properties.ValidationRules", "type": "WebTestPropertiesValidationRules"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[dict[str, str]] = None, - kind: Optional[Union[str, "_models.WebTestKind"]] = None, - synthetic_monitor_id: Optional[str] = None, - web_test_name: Optional[str] = None, - description: Optional[str] = None, - enabled: Optional[bool] = None, - frequency: int = 300, - timeout: int = 30, - web_test_kind: Optional[Union[str, "_models.WebTestKind"]] = None, - retry_enabled: Optional[bool] = None, - locations: Optional[list["_models.WebTestGeolocation"]] = None, - configuration: Optional["_models.WebTestPropertiesConfiguration"] = None, - request: Optional["_models.WebTestPropertiesRequest"] = None, - validation_rules: Optional["_models.WebTestPropertiesValidationRules"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword kind: The kind of WebTest that this web test watches. Choices are ping, multistep and - standard. Known values are: "ping", "multistep", and "standard". - :paramtype kind: str or ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestKind - :keyword synthetic_monitor_id: Unique ID of this WebTest. This is typically the same value as - the Name field. - :paramtype synthetic_monitor_id: str - :keyword web_test_name: User defined name if this WebTest. - :paramtype web_test_name: str - :keyword description: User defined description for this WebTest. - :paramtype description: str - :keyword enabled: Is the test actively being monitored. - :paramtype enabled: bool - :keyword frequency: Interval in seconds between test runs for this WebTest. Default value is - 300. - :paramtype frequency: int - :keyword timeout: Seconds until this WebTest will timeout and fail. Default value is 30. - :paramtype timeout: int - :keyword web_test_kind: The kind of web test this is, valid choices are ping, multistep and - standard. Known values are: "ping", "multistep", and "standard". - :paramtype web_test_kind: str or ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestKind - :keyword retry_enabled: Allow for retries should this WebTest fail. - :paramtype retry_enabled: bool - :keyword locations: A list of where to physically run the tests from to give global coverage - for accessibility of your application. - :paramtype locations: - list[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestGeolocation] - :keyword configuration: An XML configuration specification for a WebTest. - :paramtype configuration: - ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesConfiguration - :keyword request: The collection of request properties. - :paramtype request: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesRequest - :keyword validation_rules: The collection of validation rule properties. - :paramtype validation_rules: - ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRules - """ - super().__init__(location=location, tags=tags, **kwargs) - self.kind = kind - self.synthetic_monitor_id = synthetic_monitor_id - self.web_test_name = web_test_name - self.description = description - self.enabled = enabled - self.frequency = frequency - self.timeout = timeout - self.web_test_kind = web_test_kind - self.retry_enabled = retry_enabled - self.locations = locations - self.configuration = configuration - self.provisioning_state: Optional[str] = None - self.request = request - self.validation_rules = validation_rules - - -class WebTestGeolocation(_serialization.Model): - """Geo-physical location to run a WebTest from. You must specify one or more locations for the - test to run from. - - :ivar location: Location ID for the WebTest to run from. - :vartype location: str - """ - - _attribute_map = { - "location": {"key": "Id", "type": "str"}, - } - - def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword location: Location ID for the WebTest to run from. - :paramtype location: str - """ - super().__init__(**kwargs) - self.location = location - - -class WebTestListResult(_serialization.Model): - """A list of 0 or more Application Insights WebTest definitions. - - All required parameters must be populated in order to send to server. - - :ivar value: Set of Application Insights WebTest definitions. Required. - :vartype value: list[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] - :ivar next_link: The link to get the next part of the returned list of WebTest, should the - return set be too large for a single request. May be null. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[WebTest]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: list["_models.WebTest"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Set of Application Insights WebTest definitions. Required. - :paramtype value: list[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] - :keyword next_link: The link to get the next part of the returned list of WebTest, should the - return set be too large for a single request. May be null. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class WebTestPropertiesConfiguration(_serialization.Model): - """An XML configuration specification for a WebTest. - - :ivar web_test: The XML specification of a WebTest to run against an application. - :vartype web_test: str - """ - - _attribute_map = { - "web_test": {"key": "WebTest", "type": "str"}, - } - - def __init__(self, *, web_test: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword web_test: The XML specification of a WebTest to run against an application. - :paramtype web_test: str - """ - super().__init__(**kwargs) - self.web_test = web_test - - -class WebTestPropertiesRequest(_serialization.Model): - """The collection of request properties. - - :ivar request_url: Url location to test. - :vartype request_url: str - :ivar headers: List of headers and their values to add to the WebTest call. - :vartype headers: list[~azure.mgmt.applicationinsights.v2022_06_15.models.HeaderField] - :ivar http_verb: Http verb to use for this web test. - :vartype http_verb: str - :ivar request_body: Base64 encoded string body to send with this web test. - :vartype request_body: str - :ivar parse_dependent_requests: Parse Dependent request for this WebTest. - :vartype parse_dependent_requests: bool - :ivar follow_redirects: Follow redirects for this web test. - :vartype follow_redirects: bool - """ - - _attribute_map = { - "request_url": {"key": "RequestUrl", "type": "str"}, - "headers": {"key": "Headers", "type": "[HeaderField]"}, - "http_verb": {"key": "HttpVerb", "type": "str"}, - "request_body": {"key": "RequestBody", "type": "str"}, - "parse_dependent_requests": {"key": "ParseDependentRequests", "type": "bool"}, - "follow_redirects": {"key": "FollowRedirects", "type": "bool"}, - } - - def __init__( - self, - *, - request_url: Optional[str] = None, - headers: Optional[list["_models.HeaderField"]] = None, - http_verb: Optional[str] = None, - request_body: Optional[str] = None, - parse_dependent_requests: Optional[bool] = None, - follow_redirects: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword request_url: Url location to test. - :paramtype request_url: str - :keyword headers: List of headers and their values to add to the WebTest call. - :paramtype headers: list[~azure.mgmt.applicationinsights.v2022_06_15.models.HeaderField] - :keyword http_verb: Http verb to use for this web test. - :paramtype http_verb: str - :keyword request_body: Base64 encoded string body to send with this web test. - :paramtype request_body: str - :keyword parse_dependent_requests: Parse Dependent request for this WebTest. - :paramtype parse_dependent_requests: bool - :keyword follow_redirects: Follow redirects for this web test. - :paramtype follow_redirects: bool - """ - super().__init__(**kwargs) - self.request_url = request_url - self.headers = headers - self.http_verb = http_verb - self.request_body = request_body - self.parse_dependent_requests = parse_dependent_requests - self.follow_redirects = follow_redirects - - -class WebTestPropertiesValidationRules(_serialization.Model): - """The collection of validation rule properties. - - :ivar content_validation: The collection of content validation properties. - :vartype content_validation: - ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRulesContentValidation - :ivar ssl_check: Checks to see if the SSL cert is still valid. - :vartype ssl_check: bool - :ivar ssl_cert_remaining_lifetime_check: A number of days to check still remain before the the - existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. - :vartype ssl_cert_remaining_lifetime_check: int - :ivar expected_http_status_code: Validate that the WebTest returns the http status code - provided. - :vartype expected_http_status_code: int - :ivar ignore_http_status_code: When set, validation will ignore the status code. - :vartype ignore_http_status_code: bool - """ - - _attribute_map = { - "content_validation": {"key": "ContentValidation", "type": "WebTestPropertiesValidationRulesContentValidation"}, - "ssl_check": {"key": "SSLCheck", "type": "bool"}, - "ssl_cert_remaining_lifetime_check": {"key": "SSLCertRemainingLifetimeCheck", "type": "int"}, - "expected_http_status_code": {"key": "ExpectedHttpStatusCode", "type": "int"}, - "ignore_http_status_code": {"key": "IgnoreHttpStatusCode", "type": "bool"}, - } - - def __init__( - self, - *, - content_validation: Optional["_models.WebTestPropertiesValidationRulesContentValidation"] = None, - ssl_check: Optional[bool] = None, - ssl_cert_remaining_lifetime_check: Optional[int] = None, - expected_http_status_code: Optional[int] = None, - ignore_http_status_code: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword content_validation: The collection of content validation properties. - :paramtype content_validation: - ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTestPropertiesValidationRulesContentValidation - :keyword ssl_check: Checks to see if the SSL cert is still valid. - :paramtype ssl_check: bool - :keyword ssl_cert_remaining_lifetime_check: A number of days to check still remain before the - the existing SSL cert expires. Value must be positive and the SSLCheck must be set to true. - :paramtype ssl_cert_remaining_lifetime_check: int - :keyword expected_http_status_code: Validate that the WebTest returns the http status code - provided. - :paramtype expected_http_status_code: int - :keyword ignore_http_status_code: When set, validation will ignore the status code. - :paramtype ignore_http_status_code: bool - """ - super().__init__(**kwargs) - self.content_validation = content_validation - self.ssl_check = ssl_check - self.ssl_cert_remaining_lifetime_check = ssl_cert_remaining_lifetime_check - self.expected_http_status_code = expected_http_status_code - self.ignore_http_status_code = ignore_http_status_code - - -class WebTestPropertiesValidationRulesContentValidation(_serialization.Model): # pylint: disable=name-too-long - """The collection of content validation properties. - - :ivar content_match: Content to look for in the return of the WebTest. Must not be null or - empty. - :vartype content_match: str - :ivar ignore_case: When set, this value makes the ContentMatch validation case insensitive. - :vartype ignore_case: bool - :ivar pass_if_text_found: When true, validation will pass if there is a match for the - ContentMatch string. If false, validation will fail if there is a match. - :vartype pass_if_text_found: bool - """ - - _attribute_map = { - "content_match": {"key": "ContentMatch", "type": "str"}, - "ignore_case": {"key": "IgnoreCase", "type": "bool"}, - "pass_if_text_found": {"key": "PassIfTextFound", "type": "bool"}, - } - - def __init__( - self, - *, - content_match: Optional[str] = None, - ignore_case: Optional[bool] = None, - pass_if_text_found: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword content_match: Content to look for in the return of the WebTest. Must not be null or - empty. - :paramtype content_match: str - :keyword ignore_case: When set, this value makes the ContentMatch validation case insensitive. - :paramtype ignore_case: bool - :keyword pass_if_text_found: When true, validation will pass if there is a match for the - ContentMatch string. If false, validation will fail if there is a match. - :paramtype pass_if_text_found: bool - """ - super().__init__(**kwargs) - self.content_match = content_match - self.ignore_case = ignore_case - self.pass_if_text_found = pass_if_text_found diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/models/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/__init__.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/__init__.py deleted file mode 100644 index 87f6c44f1147..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/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. -# -------------------------------------------------------------------------- -# pylint: disable=wrong-import-position - -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from ._patch import * # pylint: disable=unused-wildcard-import - -from ._web_tests_operations import WebTestsOperations # type: ignore - -from ._patch import __all__ as _patch_all -from ._patch import * -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "WebTestsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore -_patch_sdk() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_patch.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_patch.py deleted file mode 100644 index 87676c65a8f0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_patch.py +++ /dev/null @@ -1,21 +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. -# -------------------------------------------------------------------------- -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" - - -__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/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_web_tests_operations.py deleted file mode 100644 index d0893a4aae7e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/operations/_web_tests_operations.py +++ /dev/null @@ -1,891 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ApplicationInsightsManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, web_test_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", "2022-06-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "webTestName": _SERIALIZER.url("web_test_name", web_test_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_create_or_update_request( - resource_group_name: str, web_test_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", "2022-06-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_tags_request( - resource_group_name: str, web_test_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", "2022-06-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, web_test_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", - ) - 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 - ), - "webTestName": _SERIALIZER.url("web_test_name", web_test_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests") - 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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_component_request( - component_name: str, resource_group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{componentName}/webtests", - ) - path_format_arguments = { - "componentName": _SERIALIZER.url("component_name", component_name, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "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") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class WebTestsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.applicationinsights.v2022_06_15.ApplicationInsightsManagementClient`'s - :attr:`web_tests` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ApplicationInsightsManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined for the specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, web_test_name: str, **kwargs: Any) -> _models.WebTest: - """Get a specific Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: _models.WebTest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Required. - :type web_test_definition: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - web_test_name: str, - web_test_definition: Union[_models.WebTest, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Creates or updates an Application Insights web test definition. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_definition: Properties that need to be specified to create or update an - Application Insights web test definition. Is either a WebTest type or a IO[bytes] type. - Required. - :type web_test_definition: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest or - IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_definition, (IOBase, bytes)): - _content = web_test_definition - else: - _json = self._serialize.body(web_test_definition, "WebTest") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Updates the tags associated with an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to associate with the web test resource. - Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2022_06_15.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.WebTest: - """Updates the tags associated with an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to associate with the web test resource. - Required. - :type web_test_tags: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_tags( - self, - resource_group_name: str, - web_test_name: str, - web_test_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.WebTest: - """Updates the tags associated with an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :param web_test_tags: Updated tag information to associate with the web test resource. Is - either a TagsResource type or a IO[bytes] type. Required. - :type web_test_tags: ~azure.mgmt.applicationinsights.v2022_06_15.models.TagsResource or - IO[bytes] - :return: WebTest or the result of cls(response) - :rtype: ~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.WebTest] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(web_test_tags, (IOBase, bytes)): - _content = web_test_tags - else: - _json = self._serialize.body(web_test_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("WebTest", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, web_test_name: str, **kwargs: Any - ) -> None: - """Deletes an Application Insights web test. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param web_test_name: The name of the Application Insights WebTest resource. Required. - :type web_test_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - web_test_name=web_test_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.WebTest"]: - """Get all Application Insights web test definitions for the specified subscription. - - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_component( - self, component_name: str, resource_group_name: str, **kwargs: Any - ) -> ItemPaged["_models.WebTest"]: - """Get all Application Insights web tests defined for the specified component. - - :param component_name: The name of the Application Insights component resource. Required. - :type component_name: str - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either WebTest or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.applicationinsights.v2022_06_15.models.WebTest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WebTestListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_component_request( - component_name=component_name, - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("WebTestListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/py.typed b/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/py.typed deleted file mode 100644 index e5aff4f83af8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/azure/mgmt/applicationinsights/v2022_06_15/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/code_report_typespec.json b/sdk/applicationinsights/azure-mgmt-applicationinsights/code_report_typespec.json new file mode 100644 index 000000000000..b4138c858283 --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/code_report_typespec.json @@ -0,0 +1,28660 @@ +{ + "azure.mgmt.applicationinsights": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "send_request": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "request": { + "default": null, + "param_type": "positional_or_keyword" + }, + "stream": { + "default": "bool", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "web_tests": { + "attr_type": "WebTestsOperations" + }, + "operations": { + "attr_type": "Operations" + }, + "workbooks": { + "attr_type": "WorkbooksOperations" + }, + "workbook_templates": { + "attr_type": "WorkbookTemplatesOperations" + }, + "analytics_items": { + "attr_type": "AnalyticsItemsOperations" + }, + "annotations": { + "attr_type": "AnnotationsOperations" + }, + "api_keys": { + "attr_type": "APIKeysOperations" + }, + "export_configurations": { + "attr_type": "ExportConfigurationsOperations" + }, + "component_current_billing_features": { + "attr_type": "ComponentCurrentBillingFeaturesOperations" + }, + "component_quota_status": { + "attr_type": "ComponentQuotaStatusOperations" + }, + "component_feature_capabilities": { + "attr_type": "ComponentFeatureCapabilitiesOperations" + }, + "component_available_features": { + "attr_type": "ComponentAvailableFeaturesOperations" + }, + "proactive_detection_configurations": { + "attr_type": "ProactiveDetectionConfigurationsOperations" + }, + "work_item_configurations": { + "attr_type": "WorkItemConfigurationsOperations" + }, + "component_linked_storage_accounts": { + "attr_type": "ComponentLinkedStorageAccountsOperations" + }, + "components": { + "attr_type": "ComponentsOperations" + }, + "deleted_workbooks": { + "attr_type": "DeletedWorkbooksOperations" + }, + "favorites": { + "attr_type": "FavoritesOperations" + }, + "live_token": { + "attr_type": "LiveTokenOperations" + }, + "web_test_locations": { + "attr_type": "webTestLocationsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.operations": { + "class_nodes": { + "APIKeysOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "type": "APIKeyRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "AnalyticsItemsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope": { + "default": "none", + "param_type": "keyword_only" + }, + "type": { + "default": "none", + "param_type": "keyword_only" + }, + "include_content": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "put": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "type": "Union[str, ItemScopePath]", + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "type": "ApplicationInsightsComponentAnalyticsItem", + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "type": "Union[str, ItemScopePath]", + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "type": "Union[str, ItemScopePath]", + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "AnnotationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "type": "Annotation", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "start": { + "default": null, + "param_type": "keyword_only" + }, + "end": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentAvailableFeaturesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentCurrentBillingFeaturesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "type": "ApplicationInsightsComponentBillingFeatures", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "ComponentFeatureCapabilitiesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentLinkedStorageAccountsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_and_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "ComponentLinkedStorageAccounts", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "ComponentLinkedStorageAccountsPatch", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "ComponentQuotaStatusOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "ApplicationInsightsComponent", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get_purge_status": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "purge_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "purge": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "ComponentPurgeBody", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "DeletedWorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ExportConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "ApplicationInsightsComponentExportRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "ApplicationInsightsComponentExportRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "FavoritesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "add": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "ApplicationInsightsComponentFavorite", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_type": { + "default": "none", + "param_type": "keyword_only" + }, + "source_type": { + "default": "none", + "param_type": "keyword_only" + }, + "can_fetch_content": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "ApplicationInsightsComponentFavorite", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "LiveTokenOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_uri": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "Operations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ProactiveDetectionConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "ApplicationInsightsComponentProactiveDetectionConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WebTestsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "WebTest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_component": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "WebTestTagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WorkItemConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "WorkItemCreateConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get_default": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get_item": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_item": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "WorkItemCreateConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WorkbookTemplatesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "WorkbookTemplate", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[WorkbookTemplateUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[JSON]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "can_fetch_content": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "can_fetch_content": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "revision_get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "revision_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "revisions_list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[WorkbookUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[JSON]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "webTestLocationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.models": { + "class_nodes": { + "APIKeyRequest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "linked_read_properties": { + "type": "Optional[list[str]]", + "default": null, + "param_type": "keyword_only" + }, + "linked_write_properties": { + "type": "Optional[list[str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": "Optional", + "linked_read_properties": "Optional", + "linked_write_properties": "Optional" + } + }, + "Annotation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "category": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "event_time": { + "type": "Optional[datetime]", + "default": null, + "param_type": "keyword_only" + }, + "id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "properties": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "related_annotation": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "annotation_name": "Optional", + "category": "Optional", + "event_time": "Optional", + "id": "Optional", + "properties": "Optional", + "related_annotation": "Optional" + } + }, + "AnnotationError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "message": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "innererror": { + "type": "Optional[_models.InnerError]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional", + "innererror": "Optional" + } + }, + "ApplicationInsightsComponent": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + }, + "etag": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "properties": { + "type": "Optional[_models.ApplicationInsightsComponentProperties]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": null, + "etag": "Optional", + "properties": "Optional", + "id": "Optional", + "name": "Optional", + "type": "Optional", + "location": null, + "tags": "Optional" + } + }, + "ApplicationInsightsComponentAPIKey": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "created_date": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "linked_read_properties": { + "type": "Optional[list[str]]", + "default": null, + "param_type": "keyword_only" + }, + "linked_write_properties": { + "type": "Optional[list[str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": "Optional", + "api_key": "Optional", + "created_date": "Optional", + "name": "Optional", + "linked_read_properties": "Optional", + "linked_write_properties": "Optional" + } + }, + "ApplicationInsightsComponentAnalyticsItem": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "scope": { + "type": "Optional[Union[str, _models.ItemScope]]", + "default": null, + "param_type": "keyword_only" + }, + "type": { + "type": "Optional[Union[str, _models.ItemType]]", + "default": null, + "param_type": "keyword_only" + }, + "properties": { + "type": "Optional[_models.ApplicationInsightsComponentAnalyticsItemProperties]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": "Optional", + "name": "Optional", + "content": "Optional", + "version": "Optional", + "scope": "Optional", + "type": "Optional", + "time_created": "Optional", + "time_modified": "Optional", + "properties": "Optional" + } + }, + "ApplicationInsightsComponentAnalyticsItemProperties": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "function_alias": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "function_alias": "Optional" + } + }, + "ApplicationInsightsComponentAvailableFeatures": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "result": "Optional" + } + }, + "ApplicationInsightsComponentBillingFeatures": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "data_volume_cap": { + "type": "Optional[_models.ApplicationInsightsComponentDataVolumeCap]", + "default": null, + "param_type": "keyword_only" + }, + "current_billing_features": { + "type": "Optional[list[str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "data_volume_cap": "Optional", + "current_billing_features": "Optional" + } + }, + "ApplicationInsightsComponentDataVolumeCap": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "cap": { + "type": "Optional[float]", + "default": null, + "param_type": "keyword_only" + }, + "warning_threshold": { + "type": "Optional[int]", + "default": null, + "param_type": "keyword_only" + }, + "stop_send_notification_when_hit_threshold": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "stop_send_notification_when_hit_cap": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "cap": "Optional", + "reset_time": "Optional", + "warning_threshold": "Optional", + "stop_send_notification_when_hit_threshold": "Optional", + "stop_send_notification_when_hit_cap": "Optional", + "max_history_cap": "Optional" + } + }, + "ApplicationInsightsComponentExportConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "record_types": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "notification_queue_enabled": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "export_id": "Optional", + "instrumentation_key": "Optional", + "record_types": "Optional", + "application_name": "Optional", + "subscription_id": "Optional", + "resource_group": "Optional", + "destination_storage_subscription_id": "Optional", + "destination_storage_location_id": "Optional", + "destination_account_id": "Optional", + "destination_type": "Optional", + "is_user_enabled": "Optional", + "last_user_update": "Optional", + "notification_queue_enabled": "Optional", + "export_status": "Optional", + "last_success_time": "Optional", + "last_gap_time": "Optional", + "permanent_error_reason": "Optional", + "storage_name": "Optional", + "container_name": "Optional" + } + }, + "ApplicationInsightsComponentExportRequest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "record_types": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "destination_type": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "destination_address": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "is_enabled": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "notification_queue_enabled": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "notification_queue_uri": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "destination_storage_subscription_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "destination_storage_location_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "destination_account_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "record_types": "Optional", + "destination_type": "Optional", + "destination_address": "Optional", + "is_enabled": "Optional", + "notification_queue_enabled": "Optional", + "notification_queue_uri": "Optional", + "destination_storage_subscription_id": "Optional", + "destination_storage_location_id": "Optional", + "destination_account_id": "Optional" + } + }, + "ApplicationInsightsComponentFavorite": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "config": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "version": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "favorite_type": { + "type": "Optional[Union[str, _models.FavoriteType]]", + "default": null, + "param_type": "keyword_only" + }, + "source_type": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[list[str]]", + "default": null, + "param_type": "keyword_only" + }, + "category": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "is_generated_from_template": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": "Optional", + "config": "Optional", + "version": "Optional", + "favorite_id": "Optional", + "favorite_type": "Optional", + "source_type": "Optional", + "time_modified": "Optional", + "tags": "Optional", + "category": "Optional", + "is_generated_from_template": "Optional", + "user_id": "Optional" + } + }, + "ApplicationInsightsComponentFeature": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "feature_name": "Optional", + "meter_id": "Optional", + "meter_rate_frequency": "Optional", + "resouce_id": "Optional", + "is_hidden": "Optional", + "capabilities": "Optional", + "title": "Optional", + "is_main_feature": "Optional", + "supported_addon_features": "Optional" + } + }, + "ApplicationInsightsComponentFeatureCapabilities": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "support_export_data": "Optional", + "burst_throttle_policy": "Optional", + "metadata_class": "Optional", + "live_stream_metrics": "Optional", + "application_map": "Optional", + "work_item_integration": "Optional", + "power_bi_integration": "Optional", + "open_schema": "Optional", + "proactive_detection": "Optional", + "analytics_integration": "Optional", + "multiple_step_web_test": "Optional", + "api_access_level": "Optional", + "tracking_type": "Optional", + "daily_cap": "Optional", + "daily_cap_reset_time": "Optional", + "throttle_rate": "Optional" + } + }, + "ApplicationInsightsComponentFeatureCapability": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": "Optional", + "description": "Optional", + "value": "Optional", + "unit": "Optional", + "meter_id": "Optional", + "meter_rate_frequency": "Optional" + } + }, + "ApplicationInsightsComponentProactiveDetectionConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "enabled": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "send_emails_to_subscription_owners": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "custom_emails": { + "type": "Optional[list[str]]", + "default": null, + "param_type": "keyword_only" + }, + "last_updated_time": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "rule_definitions": { + "type": "Optional[_models.ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": "Optional", + "enabled": "Optional", + "send_emails_to_subscription_owners": "Optional", + "custom_emails": "Optional", + "last_updated_time": "Optional", + "rule_definitions": "Optional" + } + }, + "ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "display_name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "description": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "help_url": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "is_hidden": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "is_enabled_by_default": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "is_in_preview": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "supports_email_notifications": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": "Optional", + "display_name": "Optional", + "description": "Optional", + "help_url": "Optional", + "is_hidden": "Optional", + "is_enabled_by_default": "Optional", + "is_in_preview": "Optional", + "supports_email_notifications": "Optional" + } + }, + "ApplicationInsightsComponentProperties": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "application_type": { + "type": "Union[str, _models.ApplicationType]", + "default": null, + "param_type": "keyword_only" + }, + "flow_type": { + "type": "Optional[Union[str, _models.FlowType]]", + "default": null, + "param_type": "keyword_only" + }, + "request_source": { + "type": "Optional[Union[str, _models.RequestSource]]", + "default": null, + "param_type": "keyword_only" + }, + "hockey_app_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "sampling_percentage": { + "type": "Optional[float]", + "default": null, + "param_type": "keyword_only" + }, + "retention_in_days": { + "type": "Optional[int]", + "default": null, + "param_type": "keyword_only" + }, + "disable_ip_masking": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "immediate_purge_data_on30_days": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "workspace_resource_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "public_network_access_for_ingestion": { + "type": "Optional[Union[str, _models.PublicNetworkAccessType]]", + "default": null, + "param_type": "keyword_only" + }, + "public_network_access_for_query": { + "type": "Optional[Union[str, _models.PublicNetworkAccessType]]", + "default": null, + "param_type": "keyword_only" + }, + "ingestion_mode": { + "type": "Optional[Union[str, _models.IngestionMode]]", + "default": null, + "param_type": "keyword_only" + }, + "disable_local_auth": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "force_customer_storage_for_profiler": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "application_id": "Optional", + "app_id": "Optional", + "name": "Optional", + "application_type": "Union", + "flow_type": "Optional", + "request_source": "Optional", + "instrumentation_key": "Optional", + "creation_date": "Optional", + "tenant_id": "Optional", + "hockey_app_id": "Optional", + "hockey_app_token": "Optional", + "provisioning_state": "Optional", + "sampling_percentage": "Optional", + "connection_string": "Optional", + "retention_in_days": "Optional", + "disable_ip_masking": "Optional", + "immediate_purge_data_on30_days": "Optional", + "workspace_resource_id": "Optional", + "la_migration_date": "Optional", + "private_link_scoped_resources": "Optional", + "public_network_access_for_ingestion": "Optional", + "public_network_access_for_query": "Optional", + "ingestion_mode": "Optional", + "disable_local_auth": "Optional", + "force_customer_storage_for_profiler": "Optional" + } + }, + "ApplicationInsightsComponentQuotaStatus": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "app_id": "Optional", + "should_be_throttled": "Optional", + "expiration_time": "Optional" + } + }, + "ApplicationInsightsComponentWebTestLocation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "display_name": "Optional", + "tag": "Optional" + } + }, + "ApplicationType": { + "type": "Enum", + "methods": {}, + "properties": { + "OTHER": "OTHER", + "WEB": "WEB", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "CategoryType": { + "type": "Enum", + "methods": {}, + "properties": { + "PERFORMANCE": "PERFORMANCE", + "RETENTION": "RETENTION", + "TSG": "TSG", + "WORKBOOK": "WORKBOOK", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ComponentLinkedStorageAccounts": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "properties": { + "type": "Optional[_models.LinkedStorageAccountsProperties]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "properties": "Optional", + "id": "Optional", + "name": "Optional", + "type": "Optional", + "system_data": "Optional" + } + }, + "ComponentLinkedStorageAccountsPatch": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "properties": { + "type": "Optional[_models.LinkedStorageAccountsProperties]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "properties": "Optional" + } + }, + "ComponentPurgeBody": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "table": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "filters": { + "type": "list[_models.ComponentPurgeBodyFilters]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "table": null, + "filters": "list" + } + }, + "ComponentPurgeBodyFilters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "column": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "operator": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "value": { + "type": "Optional[Any]", + "default": null, + "param_type": "keyword_only" + }, + "key": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "column": "Optional", + "operator": "Optional", + "value": "Optional", + "key": "Optional" + } + }, + "ComponentPurgeResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "operation_id": { + "type": "str", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "operation_id": null + } + }, + "ComponentPurgeStatusResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "status": { + "type": "Union[str, _models.PurgeState]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "status": "Union" + } + }, + "ComponentsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": "Optional", + "name": "Optional", + "type": "Optional", + "location": null, + "tags": "Optional" + } + }, + "CreatedByType": { + "type": "Enum", + "methods": {}, + "properties": { + "APPLICATION": "APPLICATION", + "KEY": "KEY", + "MANAGED_IDENTITY": "MANAGED_IDENTITY", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "DeletedWorkbook": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "type": "Optional[Union[str, _models.DeletedWorkbookSharedTypeKind]]", + "default": null, + "param_type": "keyword_only" + }, + "etag": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "properties": { + "type": "Optional[_models.DeletedWorkbookProperties]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "type": "Optional[Union[str, _models.DeletedWorkbookSharedTypeKind]]", + "default": null, + "param_type": "keyword_only" + }, + "etag": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "properties": "Optional", + "kind": "Optional", + "etag": "Optional", + "tags": "Optional", + "location": null, + "id": "Optional", + "name": "Optional", + "type": "Optional", + "system_data": "Optional" + } + }, + "DeletedWorkbookCategoryType": { + "type": "Enum", + "methods": {}, + "properties": { + "PERFORMANCE": "PERFORMANCE", + "RETENTION": "RETENTION", + "TSG": "TSG", + "WORKBOOK": "WORKBOOK", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "DeletedWorkbookError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "type": "Optional[_models.DeletedWorkbookErrorDefinition]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": "Optional" + } + }, + "DeletedWorkbookErrorDefinition": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional", + "innererror": "Optional" + } + }, + "DeletedWorkbookInnerErrorTrace": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "trace": "Optional" + } + }, + "DeletedWorkbookProperties": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "display_name": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "serialized_data": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "category": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "version": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[list[str]]", + "default": null, + "param_type": "keyword_only" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "storage_uri": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "description": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "display_name": null, + "serialized_data": null, + "version": "Optional", + "time_modified": "Optional", + "category": null, + "tags": "Optional", + "user_id": "Optional", + "source_id": "Optional", + "storage_uri": "Optional", + "description": "Optional", + "revision": "Optional" + } + }, + "DeletedWorkbookResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "type": "Optional[Union[str, _models.DeletedWorkbookSharedTypeKind]]", + "default": null, + "param_type": "keyword_only" + }, + "etag": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": "Optional", + "etag": "Optional", + "tags": "Optional", + "location": null, + "id": "Optional", + "name": "Optional", + "type": "Optional", + "system_data": "Optional" + } + }, + "DeletedWorkbookSharedTypeKind": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ErrorFieldContract": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "message": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "target": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional", + "target": "Optional" + } + }, + "ErrorResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "message": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "details": { + "type": "Optional[list[_models.ErrorFieldContract]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional", + "details": "Optional" + } + }, + "ErrorResponseComponents": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "type": "Optional[_models.ErrorResponseComponentsError]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": "Optional" + } + }, + "ErrorResponseComponentsError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional" + } + }, + "ErrorResponseLinkedStorage": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "type": "Optional[_models.ErrorResponseLinkedStorageError]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": "Optional" + } + }, + "ErrorResponseLinkedStorageError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional" + } + }, + "FavoriteSourceType": { + "type": "Enum", + "methods": {}, + "properties": { + "EVENTS": "EVENTS", + "FUNNEL": "FUNNEL", + "IMPACT": "IMPACT", + "NOTEBOOK": "NOTEBOOK", + "RETENTION": "RETENTION", + "SEGMENTATION": "SEGMENTATION", + "SESSIONS": "SESSIONS", + "USERFLOWS": "USERFLOWS", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "FavoriteType": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "FlowType": { + "type": "Enum", + "methods": {}, + "properties": { + "BLUEFIELD": "BLUEFIELD", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "HeaderField": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "header_field_name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "header_field_value": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "header_field_name": "Optional", + "header_field_value": "Optional" + } + }, + "IngestionMode": { + "type": "Enum", + "methods": {}, + "properties": { + "APPLICATION_INSIGHTS": "APPLICATION_INSIGHTS", + "APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS": "APPLICATION_INSIGHTS_WITH_DIAGNOSTIC_SETTINGS", + "LOG_ANALYTICS": "LOG_ANALYTICS", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "InnerError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "diagnosticcontext": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "time": { + "type": "Optional[datetime]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "diagnosticcontext": "Optional", + "time": "Optional" + } + }, + "ItemScope": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "USER": "USER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ItemScopePath": { + "type": "Enum", + "methods": {}, + "properties": { + "ANALYTICS_ITEMS": "ANALYTICS_ITEMS", + "MYANALYTICS_ITEMS": "MYANALYTICS_ITEMS", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ItemType": { + "type": "Enum", + "methods": {}, + "properties": { + "FUNCTION": "FUNCTION", + "NONE": "NONE", + "QUERY": "QUERY", + "RECENT": "RECENT", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "ItemTypeParameter": { + "type": "Enum", + "methods": {}, + "properties": { + "FOLDER": "FOLDER", + "FUNCTION": "FUNCTION", + "NONE": "NONE", + "QUERY": "QUERY", + "RECENT": "RECENT", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "LinkedStorageAccountsProperties": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_account": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "linked_storage_account": "Optional" + } + }, + "LiveTokenErrorResponseLinkedStorage": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "type": "Optional[_models.LiveTokenErrorResponseLinkedStorageError]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": "Optional" + } + }, + "LiveTokenErrorResponseLinkedStorageError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional" + } + }, + "LiveTokenResponse": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "live_token": "Optional" + } + }, + "ManagedServiceIdentity": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "type": { + "type": "Union[str, _models.ManagedServiceIdentityType]", + "default": null, + "param_type": "keyword_only" + }, + "user_assigned_identities": { + "type": "Optional[dict[str, _models.UserAssignedIdentity]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "principal_id": "Optional", + "tenant_id": "Optional", + "type": "Union", + "user_assigned_identities": "Optional" + } + }, + "ManagedServiceIdentityType": { + "type": "Enum", + "methods": {}, + "properties": { + "NONE": "NONE", + "SYSTEM_ASSIGNED": "SYSTEM_ASSIGNED", + "SYSTEM_ASSIGNED_USER_ASSIGNED": "SYSTEM_ASSIGNED_USER_ASSIGNED", + "USER_ASSIGNED": "USER_ASSIGNED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "Operation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "display": { + "type": "Optional[_models.OperationDisplay]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": "Optional", + "display": "Optional" + } + }, + "OperationDisplay": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "provider": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "resource": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "operation": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "provider": "Optional", + "resource": "Optional", + "operation": "Optional" + } + }, + "PrivateLinkScopedResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "scope_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "resource_id": "Optional", + "scope_id": "Optional" + } + }, + "ProxyResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": "Optional", + "name": "Optional", + "type": "Optional", + "system_data": "Optional" + } + }, + "PublicNetworkAccessType": { + "type": "Enum", + "methods": {}, + "properties": { + "DISABLED": "DISABLED", + "ENABLED": "ENABLED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "PurgeState": { + "type": "Enum", + "methods": {}, + "properties": { + "COMPLETED": "COMPLETED", + "PENDING": "PENDING", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "RequestSource": { + "type": "Enum", + "methods": {}, + "properties": { + "REST": "REST", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "Resource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": "Optional", + "name": "Optional", + "type": "Optional", + "system_data": "Optional" + } + }, + "StorageType": { + "type": "Enum", + "methods": {}, + "properties": { + "SERVICE_PROFILER": "SERVICE_PROFILER", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "SystemData": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "created_by": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "created_by_type": { + "type": "Optional[Union[str, _models.CreatedByType]]", + "default": null, + "param_type": "keyword_only" + }, + "created_at": { + "type": "Optional[datetime]", + "default": null, + "param_type": "keyword_only" + }, + "last_modified_by": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "last_modified_by_type": { + "type": "Optional[Union[str, _models.CreatedByType]]", + "default": null, + "param_type": "keyword_only" + }, + "last_modified_at": { + "type": "Optional[datetime]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "created_by": "Optional", + "created_by_type": "Optional", + "created_at": "Optional", + "last_modified_by": "Optional", + "last_modified_by_type": "Optional", + "last_modified_at": "Optional" + } + }, + "TagsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": "Optional" + } + }, + "TrackedResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": "Optional", + "location": null, + "id": "Optional", + "name": "Optional", + "type": "Optional", + "system_data": "Optional" + } + }, + "UserAssignedIdentity": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "principal_id": "Optional", + "client_id": "Optional" + } + }, + "WebTest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "type": "Optional[Union[str, _models.WebTestKind]]", + "default": null, + "param_type": "keyword_only" + }, + "properties": { + "type": "Optional[_models.WebTestProperties]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": "Optional", + "properties": "Optional", + "id": "Optional", + "name": "Optional", + "type": "Optional", + "location": null, + "tags": "Optional" + } + }, + "WebTestGeolocation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "location": "Optional" + } + }, + "WebTestKind": { + "type": "Enum", + "methods": {}, + "properties": { + "MULTISTEP": "MULTISTEP", + "PING": "PING", + "STANDARD": "STANDARD", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "WebTestProperties": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "synthetic_monitor_id": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "web_test_kind": { + "type": "Union[str, _models.WebTestKind]", + "default": null, + "param_type": "keyword_only" + }, + "locations": { + "type": "list[_models.WebTestGeolocation]", + "default": null, + "param_type": "keyword_only" + }, + "description": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "enabled": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "frequency": { + "type": "Optional[int]", + "default": null, + "param_type": "keyword_only" + }, + "timeout": { + "type": "Optional[int]", + "default": null, + "param_type": "keyword_only" + }, + "retry_enabled": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "configuration": { + "type": "Optional[_models.WebTestPropertiesConfiguration]", + "default": null, + "param_type": "keyword_only" + }, + "request": { + "type": "Optional[_models.WebTestPropertiesRequest]", + "default": null, + "param_type": "keyword_only" + }, + "validation_rules": { + "type": "Optional[_models.WebTestPropertiesValidationRules]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "synthetic_monitor_id": null, + "web_test_name": null, + "description": "Optional", + "enabled": "Optional", + "frequency": "Optional", + "timeout": "Optional", + "web_test_kind": "Union", + "retry_enabled": "Optional", + "locations": "list", + "configuration": "Optional", + "provisioning_state": "Optional", + "request": "Optional", + "validation_rules": "Optional" + } + }, + "WebTestPropertiesConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "web_test": "Optional" + } + }, + "WebTestPropertiesRequest": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "request_url": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "headers": { + "type": "Optional[list[_models.HeaderField]]", + "default": null, + "param_type": "keyword_only" + }, + "http_verb": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "request_body": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "parse_dependent_requests": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "follow_redirects": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "request_url": "Optional", + "headers": "Optional", + "http_verb": "Optional", + "request_body": "Optional", + "parse_dependent_requests": "Optional", + "follow_redirects": "Optional" + } + }, + "WebTestPropertiesValidationRules": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "content_validation": { + "type": "Optional[_models.WebTestPropertiesValidationRulesContentValidation]", + "default": null, + "param_type": "keyword_only" + }, + "ssl_check": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "ssl_cert_remaining_lifetime_check": { + "type": "Optional[int]", + "default": null, + "param_type": "keyword_only" + }, + "expected_http_status_code": { + "type": "Optional[int]", + "default": null, + "param_type": "keyword_only" + }, + "ignore_http_status_code": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "content_validation": "Optional", + "ssl_check": "Optional", + "ssl_cert_remaining_lifetime_check": "Optional", + "expected_http_status_code": "Optional", + "ignore_http_status_code": "Optional" + } + }, + "WebTestPropertiesValidationRulesContentValidation": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "content_match": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "ignore_case": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "pass_if_text_found": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "content_match": "Optional", + "ignore_case": "Optional", + "pass_if_text_found": "Optional" + } + }, + "WebTestTagsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": "Optional" + } + }, + "WebtestsResource": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "id": "Optional", + "name": "Optional", + "type": "Optional", + "location": null, + "tags": "Optional" + } + }, + "WorkItemConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "connector_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "config_display_name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "is_default": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "config_properties": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "connector_id": "Optional", + "config_display_name": "Optional", + "is_default": "Optional", + "id": "Optional", + "config_properties": "Optional" + } + }, + "WorkItemConfigurationError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "message": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "innererror": { + "type": "Optional[_models.InnerError]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional", + "innererror": "Optional" + } + }, + "WorkItemCreateConfiguration": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "connector_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "connector_data_configuration": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "validate_only": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "work_item_properties": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "connector_id": "Optional", + "connector_data_configuration": "Optional", + "validate_only": "Optional", + "work_item_properties": "Optional" + } + }, + "Workbook": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + }, + "properties": { + "type": "Optional[_models.WorkbookProperties]", + "default": null, + "param_type": "keyword_only" + }, + "identity": { + "type": "Optional[_models.WorkbookResourceIdentity]", + "default": null, + "param_type": "keyword_only" + }, + "kind": { + "type": "Optional[Union[str, _models.WorkbookSharedTypeKind]]", + "default": null, + "param_type": "keyword_only" + }, + "etag": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "properties": "Optional", + "identity": "Optional", + "kind": "Optional", + "etag": "Optional", + "tags": "Optional", + "location": null, + "id": "Optional", + "name": "Optional", + "type": "Optional", + "system_data": "Optional" + } + }, + "WorkbookError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "type": "Optional[_models.WorkbookErrorDefinition]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": "Optional" + } + }, + "WorkbookErrorDefinition": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional", + "innererror": "Optional" + } + }, + "WorkbookInnerErrorTrace": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "trace": "Optional" + } + }, + "WorkbookProperties": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "display_name": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "serialized_data": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "category": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "version": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[list[str]]", + "default": null, + "param_type": "keyword_only" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "storage_uri": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "description": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "display_name": null, + "serialized_data": null, + "version": "Optional", + "time_modified": "Optional", + "category": null, + "tags": "Optional", + "user_id": "Optional", + "source_id": "Optional", + "storage_uri": "Optional", + "description": "Optional", + "revision": "Optional" + } + }, + "WorkbookPropertiesUpdateParameters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "display_name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "serialized_data": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "category": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[list[str]]", + "default": null, + "param_type": "keyword_only" + }, + "description": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "revision": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "display_name": "Optional", + "serialized_data": "Optional", + "category": "Optional", + "tags": "Optional", + "description": "Optional", + "revision": "Optional" + } + }, + "WorkbookResourceIdentity": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "type": { + "type": "Union[str, _models.ManagedServiceIdentityType]", + "default": null, + "param_type": "keyword_only" + }, + "user_assigned_identities": { + "type": "Optional[dict[str, _models.UserAssignedIdentity]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "type": { + "type": "Union[str, _models.ManagedServiceIdentityType]", + "default": null, + "param_type": "keyword_only" + }, + "user_assigned_identities": { + "type": "Optional[dict[str, _models.UserAssignedIdentity]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "principal_id": "Optional", + "tenant_id": "Optional", + "type": "Union", + "user_assigned_identities": "Optional" + } + }, + "WorkbookSharedTypeKind": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + }, + "WorkbookTemplate": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + }, + "properties": { + "type": "Optional[_models.WorkbookTemplateProperties]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "location": { + "type": "str", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "properties": "Optional", + "tags": "Optional", + "location": null, + "id": "Optional", + "name": "Optional", + "type": "Optional", + "system_data": "Optional" + } + }, + "WorkbookTemplateError": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "error": { + "type": "Optional[_models.WorkbookTemplateErrorBody]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "error": "Optional" + } + }, + "WorkbookTemplateErrorBody": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "message": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "details": { + "type": "Optional[list[_models.WorkbookTemplateErrorFieldContract]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional", + "details": "Optional" + } + }, + "WorkbookTemplateErrorFieldContract": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "code": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "message": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "target": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "code": "Optional", + "message": "Optional", + "target": "Optional" + } + }, + "WorkbookTemplateGallery": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "name": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "category": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "type": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "order": { + "type": "Optional[int]", + "default": null, + "param_type": "keyword_only" + }, + "resource_type": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "name": "Optional", + "category": "Optional", + "type": "Optional", + "order": "Optional", + "resource_type": "Optional" + } + }, + "WorkbookTemplateLocalizedGallery": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "template_data": { + "type": "Optional[Any]", + "default": null, + "param_type": "keyword_only" + }, + "galleries": { + "type": "Optional[list[_models.WorkbookTemplateGallery]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "template_data": "Optional", + "galleries": "Optional" + } + }, + "WorkbookTemplateProperties": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "template_data": { + "type": "Any", + "default": null, + "param_type": "keyword_only" + }, + "galleries": { + "type": "list[_models.WorkbookTemplateGallery]", + "default": null, + "param_type": "keyword_only" + }, + "priority": { + "type": "Optional[int]", + "default": null, + "param_type": "keyword_only" + }, + "author": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "localized": { + "type": "Optional[dict[str, list[_models.WorkbookTemplateLocalizedGallery]]]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "priority": "Optional", + "author": "Optional", + "template_data": null, + "galleries": "list", + "localized": "Optional" + } + }, + "WorkbookTemplateUpdateParameters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + }, + "properties": { + "type": "Optional[_models.WorkbookTemplateProperties]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "tags": "Optional", + "properties": "Optional" + } + }, + "WorkbookUpdateParameters": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "kind": { + "type": "Optional[Union[str, _models.WorkbookUpdateSharedTypeKind]]", + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "type": "Optional[dict[str, str]]", + "default": null, + "param_type": "keyword_only" + }, + "properties": { + "type": "Optional[_models.WorkbookPropertiesUpdateParameters]", + "default": null, + "param_type": "keyword_only" + } + }, + "is_async": false, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "mapping": { + "type": "Mapping[str, Any]", + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "return_type": null + } + ] + }, + "as_dict": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "exclude_readonly": { + "default": "bool", + "param_type": "keyword_only" + } + }, + "is_async": false, + "overloads": [] + }, + "clear": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "copy": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "none", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "items": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "keys": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "pop": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "popitem": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "setdefault": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key": { + "default": null, + "param_type": "positional_or_keyword" + }, + "default": { + "default": "object", + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "values": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "kind": "Optional", + "tags": "Optional", + "properties": "Optional" + } + }, + "WorkbookUpdateSharedTypeKind": { + "type": "Enum", + "methods": {}, + "properties": { + "SHARED": "SHARED", + "capitalize": "capitalize", + "casefold": "casefold", + "center": "center", + "count": "count", + "encode": "encode", + "endswith": "endswith", + "expandtabs": "expandtabs", + "find": "find", + "format": "format", + "format_map": "format_map", + "index": "index", + "isalnum": "isalnum", + "isalpha": "isalpha", + "isascii": "isascii", + "isdecimal": "isdecimal", + "isdigit": "isdigit", + "isidentifier": "isidentifier", + "islower": "islower", + "isnumeric": "isnumeric", + "isprintable": "isprintable", + "isspace": "isspace", + "istitle": "istitle", + "isupper": "isupper", + "join": "join", + "ljust": "ljust", + "lower": "lower", + "lstrip": "lstrip", + "maketrans": "maketrans", + "partition": "partition", + "removeprefix": "removeprefix", + "removesuffix": "removesuffix", + "replace": "replace", + "rfind": "rfind", + "rindex": "rindex", + "rjust": "rjust", + "rpartition": "rpartition", + "rsplit": "rsplit", + "rstrip": "rstrip", + "split": "split", + "splitlines": "splitlines", + "startswith": "startswith", + "strip": "strip", + "swapcase": "swapcase", + "title": "title", + "translate": "translate", + "upper": "upper", + "zfill": "zfill" + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.aio": { + "class_nodes": { + "ApplicationInsightsManagementClient": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "credential": { + "default": null, + "param_type": "positional_or_keyword" + }, + "subscription_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "base_url": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "cloud_setting": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "close": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "send_request": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "request": { + "default": null, + "param_type": "positional_or_keyword" + }, + "stream": { + "default": "bool", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": { + "client_side_validation": { + "attr_type": false + }, + "web_tests": { + "attr_type": "WebTestsOperations" + }, + "operations": { + "attr_type": "Operations" + }, + "workbooks": { + "attr_type": "WorkbooksOperations" + }, + "workbook_templates": { + "attr_type": "WorkbookTemplatesOperations" + }, + "analytics_items": { + "attr_type": "AnalyticsItemsOperations" + }, + "annotations": { + "attr_type": "AnnotationsOperations" + }, + "api_keys": { + "attr_type": "APIKeysOperations" + }, + "export_configurations": { + "attr_type": "ExportConfigurationsOperations" + }, + "component_current_billing_features": { + "attr_type": "ComponentCurrentBillingFeaturesOperations" + }, + "component_quota_status": { + "attr_type": "ComponentQuotaStatusOperations" + }, + "component_feature_capabilities": { + "attr_type": "ComponentFeatureCapabilitiesOperations" + }, + "component_available_features": { + "attr_type": "ComponentAvailableFeaturesOperations" + }, + "proactive_detection_configurations": { + "attr_type": "ProactiveDetectionConfigurationsOperations" + }, + "work_item_configurations": { + "attr_type": "WorkItemConfigurationsOperations" + }, + "component_linked_storage_accounts": { + "attr_type": "ComponentLinkedStorageAccountsOperations" + }, + "components": { + "attr_type": "ComponentsOperations" + }, + "deleted_workbooks": { + "attr_type": "DeletedWorkbooksOperations" + }, + "favorites": { + "attr_type": "FavoritesOperations" + }, + "live_token": { + "attr_type": "LiveTokenOperations" + }, + "web_test_locations": { + "attr_type": "webTestLocationsOperations" + } + } + } + }, + "function_nodes": {} + }, + "azure.mgmt.applicationinsights.aio.operations": { + "class_nodes": { + "APIKeysOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "type": "APIKeyRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "api_key_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "key_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "AnalyticsItemsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "id": { + "default": "none", + "param_type": "keyword_only" + }, + "name": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope": { + "default": "none", + "param_type": "keyword_only" + }, + "type": { + "default": "none", + "param_type": "keyword_only" + }, + "include_content": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "put": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "type": "Union[str, ItemScopePath]", + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "type": "ApplicationInsightsComponentAnalyticsItem", + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "type": "Union[str, ItemScopePath]", + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "scope_path": { + "type": "Union[str, ItemScopePath]", + "default": null, + "param_type": "positional_or_keyword" + }, + "item_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "override_item": { + "type": "Optional[bool]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "AnnotationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "type": "Annotation", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "annotation_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "start": { + "default": null, + "param_type": "keyword_only" + }, + "end": { + "default": null, + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentAvailableFeaturesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentCurrentBillingFeaturesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "type": "ApplicationInsightsComponentBillingFeatures", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "billing_features_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "ComponentFeatureCapabilitiesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentLinkedStorageAccountsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_and_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "ComponentLinkedStorageAccounts", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "ComponentLinkedStorageAccountsPatch", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "storage_type": { + "type": "Union[str, StorageType]", + "default": null, + "param_type": "positional_or_keyword" + }, + "linked_storage_accounts_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "ComponentQuotaStatusOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + }, + "ComponentsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "ApplicationInsightsComponent", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "insight_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get_purge_status": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "purge_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "purge": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "ComponentPurgeBody", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "body": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "TagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "component_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "DeletedWorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ExportConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "ApplicationInsightsComponentExportRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "ApplicationInsightsComponentExportRequest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "export_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "FavoritesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "add": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "ApplicationInsightsComponentFavorite", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_type": { + "default": "none", + "param_type": "keyword_only" + }, + "source_type": { + "default": "none", + "param_type": "keyword_only" + }, + "can_fetch_content": { + "default": "none", + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "ApplicationInsightsComponentFavorite", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "favorite_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "LiveTokenOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_uri": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + } + }, + "properties": {} + }, + "Operations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + }, + "ProactiveDetectionConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "ApplicationInsightsComponentProactiveDetectionConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "configuration_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "proactive_detection_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WebTestsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "WebTest", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_definition": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_component": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "component_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_tags": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "WebTestTagsResource", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "web_test_tags": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WorkItemConfigurationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "WorkItemCreateConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get_default": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get_item": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update_item": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "WorkItemCreateConfiguration", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_config_id": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "work_item_configuration_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WorkbookTemplatesOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "WorkbookTemplate", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[WorkbookTemplateUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[JSON]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_template_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "WorkbooksOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "create_or_update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "Workbook", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "JSON", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_properties": { + "type": "IO[bytes]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + }, + "delete": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "can_fetch_content": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "list_by_resource_group": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "can_fetch_content": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list_by_subscription": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "category": { + "default": null, + "param_type": "keyword_only" + }, + "tags": { + "default": "none", + "param_type": "keyword_only" + }, + "can_fetch_content": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "revision_get": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "revision_id": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [] + }, + "revisions_list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "update": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "default": "none", + "param_type": "positional_or_keyword" + }, + "source_id": { + "default": "none", + "param_type": "keyword_only" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": true, + "overloads": [ + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[WorkbookUpdateParameters]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[JSON]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + }, + { + "parameters": { + "self": { + "type": null, + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "type": "str", + "default": null, + "param_type": "positional_or_keyword" + }, + "workbook_update_parameters": { + "type": "Optional[IO[bytes]]", + "default": null, + "param_type": "positional_or_keyword" + }, + "source_id": { + "type": "Optional[str]", + "default": null, + "param_type": "keyword_only" + }, + "content_type": { + "type": "str", + "default": "application/json", + "param_type": "keyword_only" + } + }, + "is_async": true, + "return_type": null + } + ] + } + }, + "properties": {} + }, + "webTestLocationsOperations": { + "type": null, + "methods": { + "__init__": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "args": { + "default": null, + "param_type": "var_positional" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + }, + "list": { + "parameters": { + "self": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_group_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "resource_name": { + "default": null, + "param_type": "positional_or_keyword" + }, + "kwargs": { + "default": null, + "param_type": "var_keyword" + } + }, + "is_async": false, + "overloads": [] + } + }, + "properties": {} + } + }, + "function_nodes": {} + } +} \ No newline at end of file diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_delete.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_delete.py index 2c7fe973ab93..dd22e172600f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.analytics_items.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemDelete.json +# x-ms-original-file: 2015-05-01/AnalyticsItemDelete.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_get.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_get.py index 44a303c48076..713b9c721a6c 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.analytics_items.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemGet.json +# x-ms-original-file: 2015-05-01/AnalyticsItemGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_list.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_list.py index 02dec0f683bd..034b397a95bd 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.analytics_items.list( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemList.json +# x-ms-original-file: 2015-05-01/AnalyticsItemList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_put.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_put.py similarity index 86% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_put.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_put.py index 7e70bacdb2a3..a5cc692a155e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/analytics_item_put.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/analytics_item_put.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +28,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.analytics_items.put( @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnalyticsItemPut.json +# x-ms-original-file: 2015-05-01/AnalyticsItemPut.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_create.py similarity index 69% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_create.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_create.py index 99956ddf16ca..b529a60cb166 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_create.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_create.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,24 +27,23 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.annotations.create( resource_group_name="my-resource-group", resource_name="my-component", annotation_properties={ - "AnnotationName": "str", - "Category": "str", - "EventTime": "2020-02-20 00:00:00", - "Id": "str", - "Properties": "str", - "RelatedAnnotation": "null", + "AnnotationName": "TestAnnotation", + "Category": "Text", + "EventTime": "2018-01-31T13:41:38.657Z", + "Id": "444e2c08-274a-4bbb-a89e-d77bb720f44a", + "Properties": '{"Comments":"Testing","Label":"Success"}', }, ) print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsCreate.json +# x-ms-original-file: 2015-05-01/AnnotationsCreate.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_delete.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_delete.py index fcddd512226e..28e760102692 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.annotations.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsDelete.json +# x-ms-original-file: 2015-05-01/AnnotationsDelete.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_get.py similarity index 78% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_get.py index a704eb04b084..fa536658fb2a 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.annotations.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsGet.json +# x-ms-original-file: 2015-05-01/AnnotationsGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_list.py similarity index 78% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_list.py index b3ab47f2eab2..8a909c580703 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/annotations_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/annotations_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.annotations.list( @@ -41,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AnnotationsList.json +# x-ms-original-file: 2015-05-01/AnnotationsList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_create.py similarity index 85% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_create.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_create.py index 228570d5a7b5..393648390f21 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_create.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_create.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +28,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.api_keys.create( @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysCreate.json +# x-ms-original-file: 2015-05-01/APIKeysCreate.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_delete.py similarity index 78% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_delete.py index b72ca9ec2a18..f638cb644eed 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.api_keys.delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysDelete.json +# x-ms-original-file: 2015-05-01/APIKeysDelete.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_get.py similarity index 78% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_get.py index 8e21905ea589..aca6553a73d3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.api_keys.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysGet.json +# x-ms-original-file: 2015-05-01/APIKeysGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_list.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_list.py index 9e3b450de400..886c382cfd73 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/api_keys_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/api_keys_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.api_keys.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/APIKeysList.json +# x-ms-original-file: 2015-05-01/APIKeysList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/available_billing_features_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/available_billing_features_get.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/available_billing_features_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/available_billing_features_get.py index 93bdf3647f19..c12a2a88efd1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/available_billing_features_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/available_billing_features_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.component_available_features.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/AvailableBillingFeaturesGet.json +# x-ms-original-file: 2015-05-01/AvailableBillingFeaturesGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_create.py new file mode 100644 index 000000000000..49b3b1e6911f --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_create.py @@ -0,0 +1,53 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python components_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.components.create_or_update( + resource_group_name="my-resource-group", + resource_name="my-component", + insight_properties={ + "kind": "web", + "location": "South Central US", + "properties": { + "Application_Type": "web", + "Flow_Type": "Bluefield", + "Request_Source": "rest", + "WorkspaceResourceId": "/subscriptions/subid/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace", + }, + }, + ) + print(response) + + +# x-ms-original-file: 2020-02-02/ComponentsCreate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_delete.py similarity index 76% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_delete.py index a1a9acc9240f..0f171b5e54e8 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.components.delete( @@ -37,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsDelete.json +# x-ms-original-file: 2020-02-02/ComponentsDelete.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_get.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_get.py index c6606ce0bfc3..844984b1f747 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.components.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsGet.json +# x-ms-original-file: 2020-02-02/ComponentsGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list.py similarity index 76% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list.py index 6f55b525fc01..cf2fb82edca3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.components.list() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsList.json +# x-ms-original-file: 2020-02-02/ComponentsList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list_by_resource_group.py similarity index 76% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list_by_resource_group.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list_by_resource_group.py index a1bb28d669d1..6e87df09d7a9 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_list_by_resource_group.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_list_by_resource_group.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.components.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsListByResourceGroup.json +# x-ms-original-file: 2020-02-02/ComponentsListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge.py index d60265095973..3002a7dd2fec 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-00000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.components.purge( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsPurge.json +# x-ms-original-file: 2020-02-02/ComponentsPurge.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge_status.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge_status.py similarity index 76% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge_status.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge_status.py index ca0fb0a676f3..81fb15836192 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_purge_status.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_purge_status.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-00000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.components.get_purge_status( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsPurgeStatus.json +# x-ms-original-file: 2020-02-02/ComponentsPurgeStatus.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_update.py similarity index 69% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_update.py index e7c37ac9fcf2..8d350c49eaac 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_update.py @@ -1,22 +1,21 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-applicationinsights # USAGE - python current_pricing_plan_get.py + python components_update.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -28,16 +27,21 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) - response = client.component_current_pricing_plan.get( + response = client.components.create_or_update( resource_group_name="my-resource-group", resource_name="my-component", + insight_properties={ + "kind": "web", + "location": "South Central US", + "tags": {"ApplicationGatewayType": "Internal-Only", "BillingEntity": "Self"}, + }, ) print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/CurrentPricingPlanGet.json +# x-ms-original-file: 2020-02-02/ComponentsUpdate.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_update_tags_only.py similarity index 69% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update_tags_only.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_update_tags_only.py index 65b5b08ce9a6..606dcaaba0aa 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update_tags_only.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/components_update_tags_only.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,17 +27,25 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.components.update_tags( resource_group_name="my-resource-group", resource_name="my-component", - component_tags={"tags": {"str": "str"}}, + component_tags={ + "tags": { + "ApplicationGatewayType": "Internal-Only", + "BillingEntity": "Self", + "Color": "AzureBlue", + "CustomField_01": "Custom text in some random field named randomly", + "NodeType": "Edge", + } + }, ) print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsUpdateTagsOnly.json +# x-ms-original-file: 2020-02-02/ComponentsUpdateTagsOnly.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/current_billing_features_get.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/current_billing_features_get.py index 9ebbf39c421d..4c5f07f10e1d 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/current_billing_features_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.component_current_billing_features.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/CurrentBillingFeaturesGet.json +# x-ms-original-file: 2015-05-01/CurrentBillingFeaturesGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/current_billing_features_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/current_billing_features_update.py new file mode 100644 index 000000000000..adf68fd6064d --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/current_billing_features_update.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-applicationinsights +# USAGE + python current_billing_features_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ApplicationInsightsManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.component_current_billing_features.update( + resource_group_name="my-resource-group", + resource_name="my-component", + billing_features_properties={ + "CurrentBillingFeatures": ["Basic", "Application Insights Enterprise"], + "DataVolumeCap": {"Cap": 100, "StopSendNotificationWhenHitCap": True}, + }, + ) + print(response) + + +# x-ms-original-file: 2015-05-01/CurrentBillingFeaturesUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_delete.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_delete.py index b57ebeb1f175..ed109aaa5cad 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.export_configurations.delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationDelete.json +# x-ms-original-file: 2015-05-01/ExportConfigurationDelete.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_get.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_get.py index 37d8d42e8070..806242192abd 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.export_configurations.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationGet.json +# x-ms-original-file: 2015-05-01/ExportConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_update.py similarity index 60% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_update.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_update.py index 9c3b702a4a25..9b1c5f6b6045 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configuration_update.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configuration_update.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +28,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.export_configurations.update( @@ -36,20 +36,20 @@ def main(): resource_name="my-component", export_id="uGOoki0jQsyEs3IdQ83Q4QsNr4=", export_properties={ - "DestinationAccountId": "str", - "DestinationAddress": "str", - "DestinationStorageLocationId": "str", - "DestinationStorageSubscriptionId": "str", - "DestinationType": "str", - "IsEnabled": "str", - "NotificationQueueEnabled": "str", - "NotificationQueueUri": "str", - "RecordTypes": "str", + "DestinationAccountId": "/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.ClassicStorage/storageAccounts/mystorageblob", + "DestinationAddress": "https://mystorageblob.blob.core.windows.net/fchentest?sv=2015-04-05&sr=c&sig=token", + "DestinationStorageLocationId": "eastus", + "DestinationStorageSubscriptionId": "subid", + "DestinationType": "Blob", + "IsEnabled": "true", + "NotificationQueueEnabled": "false", + "NotificationQueueUri": "", + "RecordTypes": "Requests, Event, Exceptions, Metrics, PageViews, PageViewPerformance, Rdd, PerformanceCounters, Availability", }, ) print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationUpdate.json +# x-ms-original-file: 2015-05-01/ExportConfigurationUpdate.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configurations_list.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configurations_list.py index 5a4578088cf6..5e5897e3aa51 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configurations_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.export_configurations.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationsList.json +# x-ms-original-file: 2015-05-01/ExportConfigurationsList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_post.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configurations_post.py similarity index 59% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_post.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configurations_post.py index 3c1ddb75166f..1ae068f812c2 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/export_configurations_post.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/export_configurations_post.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,27 +28,27 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.export_configurations.create( resource_group_name="my-resource-group", resource_name="my-component", export_properties={ - "DestinationAccountId": "str", - "DestinationAddress": "str", - "DestinationStorageLocationId": "str", - "DestinationStorageSubscriptionId": "str", - "DestinationType": "str", - "IsEnabled": "str", - "NotificationQueueEnabled": "str", - "NotificationQueueUri": "str", - "RecordTypes": "str", + "DestinationAccountId": "/subscriptions/subid/resourceGroups/my-resource-group/providers/Microsoft.ClassicStorage/storageAccounts/mystorageblob", + "DestinationAddress": "https://mystorageblob.blob.core.windows.net/testexport?sv=2015-04-05&sr=c&sig=token", + "DestinationStorageLocationId": "eastus", + "DestinationStorageSubscriptionId": "subid", + "DestinationType": "Blob", + "IsEnabled": "true", + "NotificationQueueEnabled": "false", + "NotificationQueueUri": "", + "RecordTypes": "Requests, Event, Exceptions, Metrics, PageViews, PageViewPerformance, Rdd, PerformanceCounters, Availability", }, ) print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ExportConfigurationsPost.json +# x-ms-original-file: 2015-05-01/ExportConfigurationsPost.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_add.py similarity index 93% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_add.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_add.py index c88a89e2f34a..93afa2f5652f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_add.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_add.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +28,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.favorites.add( @@ -38,7 +38,7 @@ def main(): favorite_properties={ "Category": None, "Config": '{"MEDataModelRawJSON":"{\\n \\"version\\": \\"1.4.1\\",\\n \\"isCustomDataModel\\": true,\\n \\"items\\": [\\n {\\n \\"id\\": \\"90a7134d-9a38-4c25-88d3-a495209873eb\\",\\n \\"chartType\\": \\"Area\\",\\n \\"chartHeight\\": 4,\\n \\"metrics\\": [\\n {\\n \\"id\\": \\"preview/requests/count\\",\\n \\"metricAggregation\\": \\"Sum\\",\\n \\"color\\": \\"msportalfx-bgcolor-d0\\"\\n }\\n ],\\n \\"priorPeriod\\": false,\\n \\"clickAction\\": {\\n \\"defaultBlade\\": \\"SearchBlade\\"\\n },\\n \\"horizontalBars\\": true,\\n \\"showOther\\": true,\\n \\"aggregation\\": \\"Sum\\",\\n \\"percentage\\": false,\\n \\"palette\\": \\"fail\\",\\n \\"yAxisOption\\": 0,\\n \\"title\\": \\"\\"\\n },\\n {\\n \\"id\\": \\"0c289098-88e8-4010-b212-546815cddf70\\",\\n \\"chartType\\": \\"Area\\",\\n \\"chartHeight\\": 2,\\n \\"metrics\\": [\\n {\\n \\"id\\": \\"preview/requests/duration\\",\\n \\"metricAggregation\\": \\"Avg\\",\\n \\"color\\": \\"msportalfx-bgcolor-j1\\"\\n }\\n ],\\n \\"priorPeriod\\": false,\\n \\"clickAction\\": {\\n \\"defaultBlade\\": \\"SearchBlade\\"\\n },\\n \\"horizontalBars\\": true,\\n \\"showOther\\": true,\\n \\"aggregation\\": \\"Avg\\",\\n \\"percentage\\": false,\\n \\"palette\\": \\"greenHues\\",\\n \\"yAxisOption\\": 0,\\n \\"title\\": \\"\\"\\n },\\n {\\n \\"id\\": \\"cbdaab6f-a808-4f71-aca5-b3976cbb7345\\",\\n \\"chartType\\": \\"Bar\\",\\n \\"chartHeight\\": 4,\\n \\"metrics\\": [\\n {\\n \\"id\\": \\"preview/requests/duration\\",\\n \\"metricAggregation\\": \\"Avg\\",\\n \\"color\\": \\"msportalfx-bgcolor-d0\\"\\n }\\n ],\\n \\"priorPeriod\\": false,\\n \\"clickAction\\": {\\n \\"defaultBlade\\": \\"SearchBlade\\"\\n },\\n \\"horizontalBars\\": true,\\n \\"showOther\\": true,\\n \\"aggregation\\": \\"Avg\\",\\n \\"percentage\\": false,\\n \\"palette\\": \\"magentaHues\\",\\n \\"yAxisOption\\": 0,\\n \\"title\\": \\"\\"\\n },\\n {\\n \\"id\\": \\"1d5a6a3a-9fa1-4099-9cf9-05eff72d1b02\\",\\n \\"grouping\\": {\\n \\"kind\\": \\"ByDimension\\",\\n \\"dimension\\": \\"context.application.version\\"\\n },\\n \\"chartType\\": \\"Grid\\",\\n \\"chartHeight\\": 1,\\n \\"metrics\\": [\\n {\\n \\"id\\": \\"basicException.count\\",\\n \\"metricAggregation\\": \\"Sum\\",\\n \\"color\\": \\"msportalfx-bgcolor-g0\\"\\n },\\n {\\n \\"id\\": \\"requestFailed.count\\",\\n \\"metricAggregation\\": \\"Sum\\",\\n \\"color\\": \\"msportalfx-bgcolor-f0s2\\"\\n }\\n ],\\n \\"priorPeriod\\": true,\\n \\"clickAction\\": {\\n \\"defaultBlade\\": \\"SearchBlade\\"\\n },\\n \\"horizontalBars\\": true,\\n \\"showOther\\": true,\\n \\"percentage\\": false,\\n \\"palette\\": \\"blueHues\\",\\n \\"yAxisOption\\": 0,\\n \\"title\\": \\"\\"\\n }\\n ],\\n \\"currentFilter\\": {\\n \\"eventTypes\\": [\\n 1,\\n 2\\n ],\\n \\"typeFacets\\": {},\\n \\"isPermissive\\": false\\n },\\n \\"timeContext\\": {\\n \\"durationMs\\": 75600000,\\n \\"endTime\\": \\"2018-01-31T20:30:00.000Z\\",\\n \\"createdTime\\": \\"2018-01-31T23:54:26.280Z\\",\\n \\"isInitialTime\\": false,\\n \\"grain\\": 1,\\n \\"useDashboardTimeRange\\": false\\n },\\n \\"jsonUri\\": \\"Favorite_BlankChart\\",\\n \\"timeSource\\": 0\\n}"}', - "FavoriteId": "deadb33f-8bee-4d3b-a059-9be8dac93960", + "FavoriteId": None, "FavoriteType": "shared", "IsGeneratedFromTemplate": False, "Name": "Blah Blah Blah", @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteAdd.json +# x-ms-original-file: 2015-05-01/FavoriteAdd.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_delete.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_delete.py index 057e5d15bd9d..b266fc421203 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.favorites.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteDelete.json +# x-ms-original-file: 2015-05-01/FavoriteDelete.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_get.py similarity index 78% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_get.py index de0fd0553d4f..87035c812f22 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.favorites.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteGet.json +# x-ms-original-file: 2015-05-01/FavoriteGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_update.py similarity index 90% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_update.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_update.py index 4f358f36d4cb..aded81909a06 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorite_update.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorite_update.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +28,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.favorites.update( @@ -38,19 +38,19 @@ def main(): favorite_properties={ "Category": None, "Config": '{"MEDataModelRawJSON":"{\\"version\\": \\"1.4.1\\",\\"isCustomDataModel\\": true,\\"items\\": [{\\"id\\": \\"90a7134d-9a38-4c25-88d3-a495209873eb\\",\\"chartType\\": \\"Area\\",\\"chartHeight\\": 4,\\"metrics\\": [{\\"id\\": \\"preview/requests/count\\",\\"metricAggregation\\": \\"Sum\\",\\"color\\": \\"msportalfx-bgcolor-d0\\"}],\\"priorPeriod\\": false,\\"clickAction\\": {\\"defaultBlade\\": \\"SearchBlade\\"},\\"horizontalBars\\": true,\\"showOther\\": true,\\"aggregation\\": \\"Sum\\",\\"percentage\\": false,\\"palette\\": \\"fail\\",\\"yAxisOption\\": 0,\\"title\\": \\"\\"},{\\"id\\": \\"0c289098-88e8-4010-b212-546815cddf70\\",\\"chartType\\": \\"Area\\",\\"chartHeight\\": 2,\\"metrics\\": [{\\"id\\": \\"preview/requests/duration\\",\\"metricAggregation\\": \\"Avg\\",\\"color\\": \\"msportalfx-bgcolor-j1\\"}],\\"priorPeriod\\": false,\\"clickAction\\": {\\"defaultBlade\\": \\"SearchBlade\\"},\\"horizontalBars\\": true,\\"showOther\\": true,\\"aggregation\\": \\"Avg\\",\\"percentage\\": false,\\"palette\\": \\"greenHues\\",\\"yAxisOption\\": 0,\\"title\\": \\"\\"},{\\"id\\": \\"cbdaab6f-a808-4f71-aca5-b3976cbb7345\\",\\"chartType\\": \\"Bar\\",\\"chartHeight\\": 4,\\"metrics\\": [{\\"id\\": \\"preview/requests/duration\\",\\"metricAggregation\\": \\"Avg\\",\\"color\\": \\"msportalfx-bgcolor-d0\\"}],\\"priorPeriod\\": false,\\"clickAction\\": {\\"defaultBlade\\": \\"SearchBlade\\"},\\"horizontalBars\\": true,\\"showOther\\": true,\\"aggregation\\": \\"Avg\\",\\"percentage\\": false,\\"palette\\": \\"magentaHues\\",\\"yAxisOption\\": 0,\\"title\\": \\"\\"},{\\"id\\": \\"1d5a6a3a-9fa1-4099-9cf9-05eff72d1b02\\",\\"grouping\\": {\\"kind\\": \\"ByDimension\\",\\"dimension\\": \\"context.application.version\\"},\\"chartType\\": \\"Grid\\",\\"chartHeight\\": 1,\\"metrics\\": [{\\"id\\": \\"basicException.count\\",\\"metricAggregation\\": \\"Sum\\",\\"color\\": \\"msportalfx-bgcolor-g0\\"},{\\"id\\": \\"requestFailed.count\\",\\"metricAggregation\\": \\"Sum\\",\\"color\\": \\"msportalfx-bgcolor-f0s2\\"}],\\"priorPeriod\\": true,\\"clickAction\\": {\\"defaultBlade\\": \\"SearchBlade\\"},\\"horizontalBars\\": true,\\"showOther\\": true,\\"percentage\\": false,\\"palette\\": \\"blueHues\\",\\"yAxisOption\\": 0,\\"title\\": \\"\\"}],\\"currentFilter\\": {\\"eventTypes\\": [1,2],\\"typeFacets\\": {},\\"isPermissive\\": false},\\"timeContext\\": {\\"durationMs\\": 75600000,\\"endTime\\": \\"2018-01-31T20:30:00.000Z\\",\\"createdTime\\": \\"2018-01-31T23:54:26.280Z\\",\\"isInitialTime\\": false,\\"grain\\": 1,\\"useDashboardTimeRange\\": false},\\"jsonUri\\": \\"Favorite_BlankChart\\",\\"timeSource\\": 0}"}', - "FavoriteId": "deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", + "FavoriteId": None, "FavoriteType": "shared", "IsGeneratedFromTemplate": False, "Name": "Derek Changed This", "SourceType": None, "Tags": ["TagSample01", "TagSample02", "TagSample03"], - "TimeModified": "2018-02-02T18:39:11.6569686Z", + "TimeModified": None, "Version": "ME", }, ) print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoriteUpdate.json +# x-ms-original-file: 2015-05-01/FavoriteUpdate.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorites_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorites_list.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorites_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorites_list.py index 64e5f4e92e29..cc9d295b067e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/favorites_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/favorites_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.favorites.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FavoritesList.json +# x-ms-original-file: 2015-05-01/FavoritesList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/feature_capabilities_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/feature_capabilities_get.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/feature_capabilities_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/feature_capabilities_get.py index ded7e1adfd2b..1616fe7b0a8e 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/feature_capabilities_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/feature_capabilities_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.component_feature_capabilities.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/FeatureCapabilitiesGet.json +# x-ms-original-file: 2015-05-01/FeatureCapabilitiesGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configuration_get.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configuration_get.py index a5cc51a26c19..356a646b0609 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configuration_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.proactive_detection_configurations.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationGet.json +# x-ms-original-file: 2015-05-01/ProactiveDetectionConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configuration_update.py similarity index 59% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_update.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configuration_update.py index 220d0d11869e..4904a9959308 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configuration_update.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configuration_update.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +28,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.proactive_detection_configurations.update( @@ -36,26 +36,26 @@ def main(): resource_name="my-component", configuration_id="slowpageloadtime", proactive_detection_properties={ - "CustomEmails": ["str"], - "Enabled": bool, - "LastUpdatedTime": "str", - "Name": "str", - "RuleDefinitions": { - "Description": "str", - "DisplayName": "str", - "HelpUrl": "str", - "IsEnabledByDefault": bool, - "IsHidden": bool, - "IsInPreview": bool, - "Name": "str", - "SupportsEmailNotifications": bool, + "customEmails": ["foo@microsoft.com", "foo2@microsoft.com"], + "enabled": True, + "lastUpdatedTime": None, + "name": "slowpageloadtime", + "ruleDefinitions": { + "Description": "Smart Detection rules notify you of performance anomaly issues.", + "DisplayName": "Slow page load time", + "HelpUrl": "https://docs.microsoft.com/en-us/azure/application-insights/app-insights-proactive-performance-diagnostics", + "IsEnabledByDefault": True, + "IsHidden": False, + "IsInPreview": False, + "Name": "slowpageloadtime", + "SupportsEmailNotifications": True, }, - "SendEmailsToSubscriptionOwners": bool, + "sendEmailsToSubscriptionOwners": True, }, ) print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationUpdate.json +# x-ms-original-file: 2015-05-01/ProactiveDetectionConfigurationUpdate.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configurations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configurations_list.py similarity index 76% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configurations_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configurations_list.py index 621eac29bef8..d43216b26f17 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/proactive_detection_configurations_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/proactive_detection_configurations_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.proactive_detection_configurations.list( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ProactiveDetectionConfigurationsList.json +# x-ms-original-file: 2015-05-01/ProactiveDetectionConfigurationsList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/quota_status_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/quota_status_get.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/quota_status_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/quota_status_get.py index 2913421a91a3..1101fe40c5ef 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/quota_status_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/quota_status_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.component_quota_status.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/QuotaStatusGet.json +# x-ms-original-file: 2015-05-01/QuotaStatusGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_create.py deleted file mode 100644 index 3c3f18c2258c..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_create.py +++ /dev/null @@ -1,69 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.create_or_update( - resource_group_name="my-resource-group", - resource_name="my-component", - insight_properties={ - "kind": "str", - "location": "str", - "AppId": "str", - "ApplicationId": "str", - "Application_Type": "web", - "ConnectionString": "str", - "CreationDate": "2020-02-20 00:00:00", - "DisableIpMasking": bool, - "Flow_Type": "Bluefield", - "HockeyAppId": "str", - "HockeyAppToken": "str", - "ImmediatePurgeDataOn30Days": bool, - "IngestionMode": "ApplicationInsights", - "InstrumentationKey": "str", - "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], - "Request_Source": "rest", - "RetentionInDays": 90, - "SamplingPercentage": 0.0, - "TenantId": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_delete.py deleted file mode 100644 index b28debc094db..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.components.delete( - resource_group_name="my-resource-group", - resource_name="my-component", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list.py deleted file mode 100644 index 83b602169d11..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list_by_resource_group.py deleted file mode 100644 index f0f911682334..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.list_by_resource_group( - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge.py deleted file mode 100644 index e514b5f6f364..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_purge.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-00000000000", - ) - - response = client.components.purge( - resource_group_name="OIAutoRest5123", - resource_name="aztest5048", - body={ - "filters": [{"column": "TimeGenerated", "operator": ">", "value": "2017-09-01T00:00:00"}], - "table": "Heartbeat", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsPurge.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge_status.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge_status.py deleted file mode 100644 index 9706242b0933..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_purge_status.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_purge_status.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-00000000000", - ) - - response = client.components.get_purge_status( - resource_group_name="OIAutoRest5123", - resource_name="aztest5048", - purge_id="purge-970318e7-b859-4edb-8903-83b1b54d0b74", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsPurgeStatus.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update.py deleted file mode 100644 index f2ec3e53775a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/components_update.py +++ /dev/null @@ -1,69 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.create_or_update( - resource_group_name="my-resource-group", - resource_name="my-component", - insight_properties={ - "kind": "str", - "location": "str", - "AppId": "str", - "ApplicationId": "str", - "Application_Type": "web", - "ConnectionString": "str", - "CreationDate": "2020-02-20 00:00:00", - "DisableIpMasking": bool, - "Flow_Type": "Bluefield", - "HockeyAppId": "str", - "HockeyAppToken": "str", - "ImmediatePurgeDataOn30Days": bool, - "IngestionMode": "ApplicationInsights", - "InstrumentationKey": "str", - "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], - "Request_Source": "rest", - "RetentionInDays": 90, - "SamplingPercentage": 0.0, - "TenantId": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/ComponentsUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_update.py deleted file mode 100644 index a8a425df9dd4..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/current_billing_features_update.py +++ /dev/null @@ -1,54 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python current_billing_features_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.component_current_billing_features.update( - resource_group_name="my-resource-group", - resource_name="my-component", - billing_features_properties={ - "CurrentBillingFeatures": ["str"], - "DataVolumeCap": { - "Cap": 0.0, - "MaxHistoryCap": 0.0, - "ResetTime": 0, - "StopSendNotificationWhenHitCap": bool, - "StopSendNotificationWhenHitThreshold": bool, - "WarningThreshold": 0, - }, - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/CurrentBillingFeaturesUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_add.py deleted file mode 100644 index 01acbdaa0cc9..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_add.py +++ /dev/null @@ -1,56 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbook_add.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-00000000", - ) - - response = client.my_workbooks.create_or_update( - resource_group_name="my-resource-group", - resource_name="deadb33f-8bee-4d3b-a059-9be8dac93960", - workbook_properties={ - "id": "c0deea5e-3344-40f2-96f8-6f8e1c3b5722", - "kind": "user", - "location": "west us", - "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", - "properties": { - "category": "workbook", - "displayName": "Blah Blah Blah", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', - "sourceId": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens", - }, - "tags": ["TagSample01", "TagSample02"], - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookAdd.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_delete.py deleted file mode 100644 index 11f3afd04df4..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbook_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.my_workbooks.delete( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_get.py deleted file mode 100644 index 690a4333d76a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbook_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.my_workbooks.get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_update.py deleted file mode 100644 index f5f07bb14eba..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbook_update.py +++ /dev/null @@ -1,56 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbook_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.my_workbooks.update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - workbook_properties={ - "kind": "user", - "location": "west us", - "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", - "properties": { - "category": "workbook", - "displayName": "Blah Blah Blah", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', - "sourceId": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens", - "version": "ME", - }, - "tags": ["TagSample01", "TagSample02"], - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbookUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbooks_list.py deleted file mode 100644 index e3c544ff77f8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/my_workbooks_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbooks_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.my_workbooks.list_by_resource_group( - resource_group_name="my-resource-group", - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/MyWorkbooksList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_create.py deleted file mode 100644 index fe97e2cb6e16..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_create.py +++ /dev/null @@ -1,62 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.create_or_update( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_definition={ - "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "str", - "Locations": [{"Id": "str"}], - "Name": "str", - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "id": "str", - "kind": "str", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_delete.py deleted file mode 100644 index 774210ea4f82..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.web_tests.delete( - resource_group_name="my-resource-group", - web_test_name="my-webtest-01-mywebservice", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_get.py deleted file mode 100644 index bba0ab20d94b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.get( - resource_group_name="my-resource-group", - web_test_name="my-webtest-01-mywebservice", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list.py deleted file mode 100644 index aaa360bb1ed6..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_component.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_component.py deleted file mode 100644 index 96b27db95238..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_component.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_list_by_component.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.list_by_component( - component_name="my-component", - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestListByComponent.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_resource_group.py deleted file mode 100644 index 024b45894859..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.list_by_resource_group( - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update.py deleted file mode 100644 index 2370d30c2c8d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update.py +++ /dev/null @@ -1,62 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.create_or_update( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_definition={ - "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "str", - "Locations": [{"Id": "str"}], - "Name": "str", - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "id": "str", - "kind": "str", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update_tags_only.py deleted file mode 100644 index 53b57e1d1434..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_update_tags_only.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_update_tags_only.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.update_tags( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_tags={"tags": {"str": "str"}}, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestUpdateTagsOnly.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_add.py deleted file mode 100644 index 3f0179ed0744..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_add.py +++ /dev/null @@ -1,59 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_add.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.workbooks.create_or_update( - resource_group_name="my-resource-group", - resource_name="deadb33f-8bee-4d3b-a059-9be8dac93960", - workbook_properties={ - "id": "c0deea5e-3344-40f2-96f8-6f8e1c3b5722", - "location": "west us", - "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", - "properties": { - "category": "workbook", - "kind": "shared", - "name": "Blah Blah Blah", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', - "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens", - "timeModified": None, - "userId": "userId", - "workbookId": "deadb33f-8bee-4d3b-a059-9be8dac93960", - }, - "tags": ["TagSample01", "TagSample02"], - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookAdd.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_delete.py deleted file mode 100644 index d5d2d7c07c99..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.workbooks.delete( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_get.py deleted file mode 100644 index b77c881a3ab7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_update.py deleted file mode 100644 index 40e50ab79c80..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbook_update.py +++ /dev/null @@ -1,58 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - workbook_properties={ - "location": "west us", - "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", - "properties": { - "category": "workbook", - "kind": "shared", - "name": "Blah Blah Blah", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', - "timeModified": None, - "userId": "userId", - "version": "ME", - "workbookId": "deadb33f-8bee-4d3b-a059-9be8dac93960", - }, - "tags": ["TagSample01", "TagSample02"], - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbookUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbooks_list.py deleted file mode 100644 index e18639c26ab0..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/workbooks_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbooks_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.list_by_resource_group( - resource_group_name="my-resource-group", - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkbooksList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_create_and_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_create_and_update.py deleted file mode 100644 index 9a8f873104a6..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_create_and_update.py +++ /dev/null @@ -1,55 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python current_pricing_plan_create_and_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.component_current_pricing_plan.create_and_update( - resource_group_name="my-resource-group", - resource_name="my-component", - pricing_plan_properties={ - "cap": 0.0, - "id": "str", - "maxHistoryCap": 0.0, - "name": "str", - "planType": "str", - "resetHour": 0, - "stopSendNotificationWhenHitCap": bool, - "stopSendNotificationWhenHitThreshold": bool, - "type": "str", - "warningThreshold": 0, - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/CurrentPricingPlanCreateAndUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_update.py deleted file mode 100644 index add639d0711d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/current_pricing_plan_update.py +++ /dev/null @@ -1,55 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python current_pricing_plan_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.component_current_pricing_plan.update( - resource_group_name="my-resource-group", - resource_name="my-component", - pricing_plan_properties={ - "cap": 0.0, - "id": "str", - "maxHistoryCap": 0.0, - "name": "str", - "planType": "str", - "resetHour": 0, - "stopSendNotificationWhenHitCap": bool, - "stopSendNotificationWhenHitThreshold": bool, - "type": "str", - "warningThreshold": 0, - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/CurrentPricingPlanUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_list_migration_date.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_list_migration_date.py deleted file mode 100644 index f91fbd007189..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_list_migration_date.py +++ /dev/null @@ -1,40 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python ea_subscription_list_migration_date.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.ea_subscription_list_migration_date.post() - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/EASubscriptionListMigrationDate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_migrate_to_new_pricing_model_post.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_migrate_to_new_pricing_model_post.py deleted file mode 100644 index 8dc2a7a50d98..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_migrate_to_new_pricing_model_post.py +++ /dev/null @@ -1,39 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python ea_subscription_migrate_to_new_pricing_model_post.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.ea_subscription_migrate_to_new_pricing_model.post() - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/EASubscriptionMigrateToNewPricingModelPost.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_rollback_to_legacy_pricing_model_post.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_rollback_to_legacy_pricing_model_post.py deleted file mode 100644 index be081bc47fbd..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2017_10_01/ea_subscription_rollback_to_legacy_pricing_model_post.py +++ /dev/null @@ -1,39 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python ea_subscription_rollback_to_legacy_pricing_model_post.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.ea_subscription_rollback_to_legacy_pricing_model.post() - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2017-10-01/examples/EASubscriptionRollbackToLegacyPricingModelPost.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_create.py deleted file mode 100644 index 6275735496fe..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_create.py +++ /dev/null @@ -1,71 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.create_or_update( - resource_group_name="my-resource-group", - resource_name="my-component", - insight_properties={ - "kind": "str", - "location": "str", - "AppId": "str", - "ApplicationId": "str", - "Application_Type": "web", - "ConnectionString": "str", - "CreationDate": "2020-02-20 00:00:00", - "DisableIpMasking": bool, - "Flow_Type": "Bluefield", - "HockeyAppId": "str", - "HockeyAppToken": "str", - "ImmediatePurgeDataOn30Days": bool, - "IngestionMode": "ApplicationInsights", - "InstrumentationKey": "str", - "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], - "Request_Source": "rest", - "RetentionInDays": 90, - "SamplingPercentage": 0.0, - "TenantId": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "publicNetworkAccessForIngestion": "Enabled", - "publicNetworkAccessForQuery": "Enabled", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_delete.py deleted file mode 100644 index 1538b89fa797..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.components.delete( - resource_group_name="my-resource-group", - resource_name="my-component", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_get.py deleted file mode 100644 index 54bac345ec1f..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.get( - resource_group_name="my-resource-group", - resource_name="my-component", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list.py deleted file mode 100644 index fccf222c07e1..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list_by_resource_group.py deleted file mode 100644 index a632f7564d80..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.list_by_resource_group( - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge.py deleted file mode 100644 index 6cc63647e2ec..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_purge.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-00000000000", - ) - - response = client.components.purge( - resource_group_name="OIAutoRest5123", - resource_name="aztest5048", - body={ - "filters": [{"column": "TimeGenerated", "operator": ">", "value": "2017-09-01T00:00:00"}], - "table": "Heartbeat", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsPurge.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge_status.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge_status.py deleted file mode 100644 index 2e3c26c9dc5e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_purge_status.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_purge_status.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-00000000000", - ) - - response = client.components.get_purge_status( - resource_group_name="OIAutoRest5123", - resource_name="aztest5048", - purge_id="purge-970318e7-b859-4edb-8903-83b1b54d0b74", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsPurgeStatus.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update.py deleted file mode 100644 index 04fd0caff9eb..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update.py +++ /dev/null @@ -1,71 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.create_or_update( - resource_group_name="my-resource-group", - resource_name="my-component", - insight_properties={ - "kind": "str", - "location": "str", - "AppId": "str", - "ApplicationId": "str", - "Application_Type": "web", - "ConnectionString": "str", - "CreationDate": "2020-02-20 00:00:00", - "DisableIpMasking": bool, - "Flow_Type": "Bluefield", - "HockeyAppId": "str", - "HockeyAppToken": "str", - "ImmediatePurgeDataOn30Days": bool, - "IngestionMode": "ApplicationInsights", - "InstrumentationKey": "str", - "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], - "Request_Source": "rest", - "RetentionInDays": 90, - "SamplingPercentage": 0.0, - "TenantId": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "publicNetworkAccessForIngestion": "Enabled", - "publicNetworkAccessForQuery": "Enabled", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update_tags_only.py deleted file mode 100644 index a3014be3f69a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/components_update_tags_only.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_update_tags_only.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.update_tags( - resource_group_name="my-resource-group", - resource_name="my-component", - component_tags={"tags": {"str": "str"}}, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ComponentsUpdateTagsOnly.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/operations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/operations_list.py deleted file mode 100644 index eed76ac5cb53..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/operations_list.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python operations_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", - ) - - response = client.operations.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/Operations_List.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_get.py deleted file mode 100644 index 6d14cbd66808..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python proactive_detection_configuration_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.proactive_detection_configurations.get( - resource_group_name="my-resource-group", - resource_name="my-component", - configuration_id="slowpageloadtime", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ProactiveDetectionConfigurationGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_update.py deleted file mode 100644 index e8e9e764611d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configuration_update.py +++ /dev/null @@ -1,65 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python proactive_detection_configuration_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.proactive_detection_configurations.update( - resource_group_name="my-resource-group", - resource_name="my-component", - configuration_id="slowpageloadtime", - proactive_detection_properties={ - "CustomEmails": ["str"], - "Enabled": bool, - "LastUpdatedTime": "str", - "Name": "str", - "RuleDefinitions": { - "Description": "str", - "DisplayName": "str", - "HelpUrl": "str", - "IsEnabledByDefault": bool, - "IsHidden": bool, - "IsInPreview": bool, - "Name": "str", - "SupportsEmailNotifications": bool, - }, - "SendEmailsToSubscriptionOwners": bool, - "id": "str", - "location": "str", - "name": "str", - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ProactiveDetectionConfigurationUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configurations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configurations_list.py deleted file mode 100644 index 8618b8bd4175..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/proactive_detection_configurations_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python proactive_detection_configurations_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.proactive_detection_configurations.list( - resource_group_name="my-resource-group", - resource_name="my-component", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/ProactiveDetectionConfigurationsList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create.py deleted file mode 100644 index 67b8f6274413..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.create_or_update( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_definition={ - "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "ping", - "Locations": [{"Id": "str"}], - "Name": "str", - "Request": { - "FollowRedirects": bool, - "Headers": [{"key": "str", "value": "str"}], - "HttpVerb": "str", - "ParseDependentRequests": bool, - "RequestBody": "str", - "RequestUrl": "str", - }, - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "ValidationRules": { - "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, - "ExpectedHttpStatusCode": 0, - "IgnoreHttpsStatusCode": bool, - "SSLCertRemainingLifetimeCheck": 0, - "SSLCheck": bool, - }, - "id": "str", - "kind": "ping", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_basic.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_basic.py deleted file mode 100644 index 56ceea715c58..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_basic.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_create_basic.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.create_or_update( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_definition={ - "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "ping", - "Locations": [{"Id": "str"}], - "Name": "str", - "Request": { - "FollowRedirects": bool, - "Headers": [{"key": "str", "value": "str"}], - "HttpVerb": "str", - "ParseDependentRequests": bool, - "RequestBody": "str", - "RequestUrl": "str", - }, - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "ValidationRules": { - "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, - "ExpectedHttpStatusCode": 0, - "IgnoreHttpsStatusCode": bool, - "SSLCertRemainingLifetimeCheck": 0, - "SSLCheck": bool, - }, - "id": "str", - "kind": "ping", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestCreateBasic.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_standard.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_standard.py deleted file mode 100644 index 85d843cb25b7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_create_standard.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_create_standard.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.create_or_update( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_definition={ - "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "ping", - "Locations": [{"Id": "str"}], - "Name": "str", - "Request": { - "FollowRedirects": bool, - "Headers": [{"key": "str", "value": "str"}], - "HttpVerb": "str", - "ParseDependentRequests": bool, - "RequestBody": "str", - "RequestUrl": "str", - }, - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "ValidationRules": { - "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, - "ExpectedHttpStatusCode": 0, - "IgnoreHttpsStatusCode": bool, - "SSLCertRemainingLifetimeCheck": 0, - "SSLCheck": bool, - }, - "id": "str", - "kind": "ping", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestCreateStandard.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_delete.py deleted file mode 100644 index 91023f5c466d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.web_tests.delete( - resource_group_name="my-resource-group", - web_test_name="my-webtest-01-mywebservice", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_get.py deleted file mode 100644 index 637e133d272f..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.get( - resource_group_name="my-resource-group", - web_test_name="my-webtest-01-mywebservice", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list.py deleted file mode 100644 index 0de31e17e47a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_component.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_component.py deleted file mode 100644 index 39dfcedd2eb2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_component.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_list_by_component.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.list_by_component( - component_name="my-component", - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestListByComponent.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_resource_group.py deleted file mode 100644 index eaa022c8e2a6..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.list_by_resource_group( - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update.py deleted file mode 100644 index 478560a3a8fe..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.create_or_update( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_definition={ - "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "ping", - "Locations": [{"Id": "str"}], - "Name": "str", - "Request": { - "FollowRedirects": bool, - "Headers": [{"key": "str", "value": "str"}], - "HttpVerb": "str", - "ParseDependentRequests": bool, - "RequestBody": "str", - "RequestUrl": "str", - }, - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "ValidationRules": { - "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, - "ExpectedHttpStatusCode": 0, - "IgnoreHttpsStatusCode": bool, - "SSLCertRemainingLifetimeCheck": 0, - "SSLCheck": bool, - }, - "id": "str", - "kind": "ping", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update_tags_only.py deleted file mode 100644 index 6158eb52a70a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_05_01_preview/web_test_update_tags_only.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_update_tags_only.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.update_tags( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_tags={"tags": {"str": "str"}}, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/examples/WebTestUpdateTagsOnly.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_add.py deleted file mode 100644 index 1ade1948ba1f..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_add.py +++ /dev/null @@ -1,59 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_06_17_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_add.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.workbooks.create_or_update( - resource_group_name="my-resource-group", - resource_name="deadb33f-8bee-4d3b-a059-9be8dac93960", - source_id="/subscriptions/ad2f1a83-caac-4e21-9d2a-9ca3f87105e2/resourceGroups/Default-Web-WestUS/providers/Microsoft.Web/sites/MyTestApp-CodeLens1", - workbook_properties={ - "id": "c0deea5e-3344-40f2-96f8-6f8e1c3b5722", - "kind": "shared", - "location": "west us", - "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", - "properties": { - "category": "workbook", - "displayName": "Blah Blah Blah", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', - "sourceId": "Azure Monitor", - "timeModified": None, - "version": "ME", - }, - "tags": None, - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-06-17-preview/examples/WorkbookAdd.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_delete.py deleted file mode 100644 index c2461c05c6ff..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_06_17_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.workbooks.delete( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-06-17-preview/examples/WorkbookDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_get.py deleted file mode 100644 index c83f4f9847d2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_06_17_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-06-17-preview/examples/WorkbookGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_update.py deleted file mode 100644 index bac5e0576c0a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbook_update.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_06_17_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - source_id="/subscriptions/ad2f1a83-caac-4e21-9d2a-9ca3f87105e2/resourceGroups/Default-Web-WestUS/providers/Microsoft.Web/sites/MyTestApp-CodeLens1", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-06-17-preview/examples/WorkbookUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbooks_list.py deleted file mode 100644 index 3861522b7d64..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2018_06_17_preview/workbooks_list.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2018_06_17_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbooks_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.list_by_resource_group( - resource_group_name="my-resource-group", - category="workbook", - source_id="/subscriptions/ad2f1a83-caac-4e21-9d2a-9ca3f87105e2/resourceGroups/Default-Web-WestUS/providers/Microsoft.Web/sites/MyTestApp-CodeLens1", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2018-06-17-preview/examples/WorkbooksList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_add.py deleted file mode 100644 index 0c7755696b4e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_add.py +++ /dev/null @@ -1,61 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2019_10_17_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_template_add.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.workbook_templates.create_or_update( - resource_group_name="my-resource-group", - resource_name="testtemplate2", - workbook_template_properties={ - "location": "west us", - "properties": { - "author": "Contoso", - "galleries": [ - { - "category": "Failures", - "name": "Simple Template", - "order": 100, - "resourceType": "microsoft.insights/components", - "type": "tsg", - } - ], - "priority": 1, - "templateData": {}, - }, - "tags": None, - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/WorkbookTemplateAdd.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_delete.py deleted file mode 100644 index aab359724859..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2019_10_17_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_template_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.workbook_templates.delete( - resource_group_name="my-resource-group", - resource_name="my-template-resource", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/WorkbookTemplateDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_get.py deleted file mode 100644 index 6fc80f0cfc85..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2019_10_17_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_template_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbook_templates.get( - resource_group_name="my-resource-group", - resource_name="my-resource-name", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/WorkbookTemplateGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_update.py deleted file mode 100644 index 5921cf9277dc..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_template_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2019_10_17_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_template_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbook_templates.update( - resource_group_name="my-resource-group", - resource_name="my-template-resource", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/WorkbookTemplateUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_templates_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_templates_list.py deleted file mode 100644 index d8efcb854908..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2019_10_17_preview/workbook_templates_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2019_10_17_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_templates_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbook_templates.list_by_resource_group( - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/WorkbookTemplatesList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_create.py deleted file mode 100644 index 221e75555227..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_create.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.create_or_update( - resource_group_name="my-resource-group", - resource_name="my-component", - insight_properties={ - "kind": "str", - "location": "str", - "AppId": "str", - "ApplicationId": "str", - "Application_Type": "web", - "ConnectionString": "str", - "CreationDate": "2020-02-20 00:00:00", - "DisableIpMasking": bool, - "DisableLocalAuth": bool, - "Flow_Type": "Bluefield", - "ForceCustomerStorageForProfiler": bool, - "HockeyAppId": "str", - "HockeyAppToken": "str", - "ImmediatePurgeDataOn30Days": bool, - "IngestionMode": "LogAnalytics", - "InstrumentationKey": "str", - "LaMigrationDate": "2020-02-20 00:00:00", - "Name": "str", - "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], - "Request_Source": "rest", - "RetentionInDays": 0, - "SamplingPercentage": 0.0, - "TenantId": "str", - "WorkspaceResourceId": "str", - "etag": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "publicNetworkAccessForIngestion": "Enabled", - "publicNetworkAccessForQuery": "Enabled", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_get.py deleted file mode 100644 index ef844f69bd43..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.get( - resource_group_name="my-resource-group", - resource_name="my-component", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update.py deleted file mode 100644 index b936dbe51d6b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.create_or_update( - resource_group_name="my-resource-group", - resource_name="my-component", - insight_properties={ - "kind": "str", - "location": "str", - "AppId": "str", - "ApplicationId": "str", - "Application_Type": "web", - "ConnectionString": "str", - "CreationDate": "2020-02-20 00:00:00", - "DisableIpMasking": bool, - "DisableLocalAuth": bool, - "Flow_Type": "Bluefield", - "ForceCustomerStorageForProfiler": bool, - "HockeyAppId": "str", - "HockeyAppToken": "str", - "ImmediatePurgeDataOn30Days": bool, - "IngestionMode": "LogAnalytics", - "InstrumentationKey": "str", - "LaMigrationDate": "2020-02-20 00:00:00", - "Name": "str", - "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], - "Request_Source": "rest", - "RetentionInDays": 0, - "SamplingPercentage": 0.0, - "TenantId": "str", - "WorkspaceResourceId": "str", - "etag": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "publicNetworkAccessForIngestion": "Enabled", - "publicNetworkAccessForQuery": "Enabled", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update_tags_only.py deleted file mode 100644 index 2893c014793f..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02/components_update_tags_only.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_update_tags_only.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.update_tags( - resource_group_name="my-resource-group", - resource_name="my-component", - component_tags={"tags": {"str": "str"}}, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-02-02/examples/ComponentsUpdateTagsOnly.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_create.py deleted file mode 100644 index 0994a1c974b3..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_create.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.create_or_update( - resource_group_name="my-resource-group", - resource_name="my-component", - insight_properties={ - "kind": "str", - "location": "str", - "AppId": "str", - "ApplicationId": "str", - "Application_Type": "web", - "ConnectionString": "str", - "CreationDate": "2020-02-20 00:00:00", - "DisableIpMasking": bool, - "DisableLocalAuth": bool, - "Flow_Type": "Bluefield", - "ForceCustomerStorageForProfiler": bool, - "HockeyAppId": "str", - "HockeyAppToken": "str", - "ImmediatePurgeDataOn30Days": bool, - "IngestionMode": "LogAnalytics", - "InstrumentationKey": "str", - "LaMigrationDate": "2020-02-20 00:00:00", - "Name": "str", - "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], - "Request_Source": "rest", - "RetentionInDays": 0, - "SamplingPercentage": 0.0, - "TenantId": "str", - "WorkspaceResourceId": "str", - "etag": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "publicNetworkAccessForIngestion": "Enabled", - "publicNetworkAccessForQuery": "Enabled", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_delete.py deleted file mode 100644 index bd71ad9ac2cc..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.components.delete( - resource_group_name="my-resource-group", - resource_name="my-component", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_get.py deleted file mode 100644 index a965d35a3963..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.get( - resource_group_name="my-resource-group", - resource_name="my-component", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list.py deleted file mode 100644 index b4b66debb3d2..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list_by_resource_group.py deleted file mode 100644 index 8c662b544d63..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.list_by_resource_group( - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge.py deleted file mode 100644 index 08d61a6191de..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge.py +++ /dev/null @@ -1,47 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_purge.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-00000000000", - ) - - response = client.components.purge( - resource_group_name="OIAutoRest5123", - resource_name="aztest5048", - body={ - "filters": [{"column": "TimeGenerated", "operator": ">", "value": "2017-09-01T00:00:00"}], - "table": "Heartbeat", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsPurge.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge_status.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge_status.py deleted file mode 100644 index dc77d567382e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_purge_status.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_purge_status.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-00000000000", - ) - - response = client.components.get_purge_status( - resource_group_name="OIAutoRest5123", - resource_name="aztest5048", - purge_id="purge-970318e7-b859-4edb-8903-83b1b54d0b74", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsPurgeStatus.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update.py deleted file mode 100644 index 93d88489db3c..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.create_or_update( - resource_group_name="my-resource-group", - resource_name="my-component", - insight_properties={ - "kind": "str", - "location": "str", - "AppId": "str", - "ApplicationId": "str", - "Application_Type": "web", - "ConnectionString": "str", - "CreationDate": "2020-02-20 00:00:00", - "DisableIpMasking": bool, - "DisableLocalAuth": bool, - "Flow_Type": "Bluefield", - "ForceCustomerStorageForProfiler": bool, - "HockeyAppId": "str", - "HockeyAppToken": "str", - "ImmediatePurgeDataOn30Days": bool, - "IngestionMode": "LogAnalytics", - "InstrumentationKey": "str", - "LaMigrationDate": "2020-02-20 00:00:00", - "Name": "str", - "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], - "Request_Source": "rest", - "RetentionInDays": 0, - "SamplingPercentage": 0.0, - "TenantId": "str", - "WorkspaceResourceId": "str", - "etag": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "publicNetworkAccessForIngestion": "Enabled", - "publicNetworkAccessForQuery": "Enabled", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update_tags_only.py deleted file mode 100644 index aa01666345bd..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_02_02_preview/components_update_tags_only.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_02_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python components_update_tags_only.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.components.update_tags( - resource_group_name="my-resource-group", - resource_name="my-component", - component_tags={"tags": {"str": "str"}}, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-02-02-preview/examples/ComponentsUpdateTagsOnly.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_create_and_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_create_and_update.py deleted file mode 100644 index bd323a646e2d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_create_and_update.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_03_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python component_linked_storage_accounts_create_and_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4918", - ) - - response = client.component_linked_storage_accounts.create_and_update( - resource_group_name="someResourceGroupName", - resource_name="myComponent", - storage_type="ServiceProfiler", - linked_storage_accounts_properties={"id": "str", "linkedStorageAccount": "str", "name": "str", "type": "str"}, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsCreateAndUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_delete.py deleted file mode 100644 index 09c349c0acdc..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_03_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python component_linked_storage_accounts_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4918", - ) - - client.component_linked_storage_accounts.delete( - resource_group_name="someResourceGroupName", - resource_name="myComponent", - storage_type="ServiceProfiler", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_get.py deleted file mode 100644 index 334c53501ef6..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_03_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python component_linked_storage_accounts_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4918", - ) - - response = client.component_linked_storage_accounts.get( - resource_group_name="someResourceGroupName", - resource_name="myComponent", - storage_type="ServiceProfiler", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_update.py deleted file mode 100644 index fee33965b95b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_03_01_preview/component_linked_storage_accounts_update.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_03_01_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python component_linked_storage_accounts_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4918", - ) - - response = client.component_linked_storage_accounts.update( - resource_group_name="someResourceGroupName", - resource_name="myComponent", - storage_type="ServiceProfiler", - linked_storage_accounts_properties={"linkedStorageAccount": "str"}, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-03-01-preview/examples/ComponentLinkedStorageAccountsUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/live_token_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/live_token_get.py deleted file mode 100644 index d33c1f1608b8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/live_token_get.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_06_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python live_token_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.live_token.get( - resource_uri="subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/FabrikamFiberApp/providers/microsoft.insights/components/CustomAvailabilityTest/providers/microsoft.insights/generatelivetoken", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-06-02-preview/examples/LiveTokenGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/operations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/operations_list.py deleted file mode 100644 index 2e2f875235c9..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_06_02_preview/operations_list.py +++ /dev/null @@ -1,40 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_06_02_preview import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python operations_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.operations.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/preview/2020-06-02-preview/examples/Operations_List.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_add.py deleted file mode 100644 index 16e0c5cc4a6a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_add.py +++ /dev/null @@ -1,86 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_template_add.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.workbook_templates.create_or_update( - resource_group_name="my-resource-group", - resource_name="testtemplate2", - workbook_template_properties={ - "location": "west us", - "properties": { - "author": "Contoso", - "galleries": [ - { - "category": "Failures", - "name": "Simple Template", - "order": 100, - "resourceType": "microsoft.insights/components", - "type": "tsg", - } - ], - "priority": 1, - "templateData": { - "$schema": "https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json", - "items": [ - { - "content": { - "json": "## New workbook\n---\n\nWelcome to your new workbook. This area will display text formatted as markdown.\n\n\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections." - }, - "name": "text - 2", - "type": 1, - }, - { - "content": { - "exportToExcelOptions": "visible", - "query": "union withsource=TableName *\n| summarize Count=count() by TableName\n| render barchart", - "queryType": 0, - "resourceType": "microsoft.operationalinsights/workspaces", - "size": 1, - "version": "KqlItem/1.0", - }, - "name": "query - 2", - "type": 3, - }, - ], - "styleSettings": {}, - "version": "Notebook/1.0", - }, - }, - "tags": None, - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplateAdd.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_delete.py deleted file mode 100644 index 202036ce193a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_template_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.workbook_templates.delete( - resource_group_name="my-resource-group", - resource_name="my-template-resource", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplateDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_get.py deleted file mode 100644 index fcafe6ae9a53..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_template_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbook_templates.get( - resource_group_name="my-resource-group", - resource_name="my-resource-name", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplateGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_update.py deleted file mode 100644 index 665fd729fe8b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_template_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_template_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbook_templates.update( - resource_group_name="my-resource-group", - resource_name="my-template-resource", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplateUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_templates_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_templates_list.py deleted file mode 100644 index cc71f0667ecb..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2020_11_20/workbook_templates_list.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_templates_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbook_templates.list_by_resource_group( - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2020-11-20/examples/WorkbookTemplatesList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_add.py deleted file mode 100644 index b5faa52c76ad..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_add.py +++ /dev/null @@ -1,56 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbook_add.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-00000000", - ) - - response = client.my_workbooks.create_or_update( - resource_group_name="my-resource-group", - resource_name="deadb33f-8bee-4d3b-a059-9be8dac93960", - workbook_properties={ - "id": "c0deea5e-3344-40f2-96f8-6f8e1c3b5722", - "kind": "user", - "location": "west us", - "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", - "properties": { - "category": "workbook", - "displayName": "Blah Blah Blah", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', - "sourceId": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens", - }, - "tags": ["TagSample01", "TagSample02"], - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookAdd.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_delete.py deleted file mode 100644 index 3cc58a8cbd58..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbook_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.my_workbooks.delete( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_get.py deleted file mode 100644 index b580e7ef3023..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbook_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.my_workbooks.get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_update.py deleted file mode 100644 index 77d28ca508f5..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbook_update.py +++ /dev/null @@ -1,57 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbook_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.my_workbooks.update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - workbook_properties={ - "kind": "user", - "location": "west us", - "name": "deadb33f-8bee-4d3b-a059-9be8dac93960", - "properties": { - "category": "workbook", - "displayName": "Blah Blah Blah", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', - "sourceId": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/MyGroup/providers/Microsoft.Web/sites/MyTestApp-CodeLens", - "storageUri": None, - "version": "ME", - }, - "tags": ["TagSample01", "TagSample02"], - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbookUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list.py deleted file mode 100644 index b95964378693..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbooks_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.my_workbooks.list_by_resource_group( - resource_group_name="my-resource-group", - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbooksList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list2.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list2.py deleted file mode 100644 index 9a3a431e1ffa..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_03_08/my_workbooks_list2.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python my_workbooks_list2.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.my_workbooks.list_by_resource_group( - resource_group_name="my-resource-group", - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-03-08/examples/MyWorkbooksList2.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_add.py deleted file mode 100644 index 50261931aad6..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_add.py +++ /dev/null @@ -1,54 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_add.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.create_or_update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - workbook_properties={ - "kind": "shared", - "location": "westus", - "properties": { - "category": "workbook", - "description": "Sample workbook", - "displayName": "Sample workbook", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', - }, - "tags": {"TagSample01": "sample01", "TagSample02": "sample02"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookAdd.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_delete.py deleted file mode 100644 index dfcf74cd9bf7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - client.workbooks.delete( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get.py deleted file mode 100644 index 6329a1be8512..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get1.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get1.py deleted file mode 100644 index ddb09e3c35d3..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_get1.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_get1.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookGet1.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_add.py deleted file mode 100644 index e1e81d87f0cf..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_add.py +++ /dev/null @@ -1,61 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_managed_add.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.create_or_update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - workbook_properties={ - "identity": { - "type": "UserAssigned", - "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myid": {} - }, - }, - "kind": "shared", - "location": "westus", - "properties": { - "category": "workbook", - "description": "Sample workbook", - "displayName": "Sample workbook", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":{"json":"test"},"name":"text - 0"}],"isLocked":false,"fallbackResourceIds":["/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/my-resource-group"]}', - "storageUri": "/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorage/blobServices/default/containers/mycontainer", - "version": "Notebook/1.0", - }, - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookManagedAdd.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_get.py deleted file mode 100644 index 61bdb251d237..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_managed_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookManagedGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_update.py deleted file mode 100644 index 56da13419c2d..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_managed_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_managed_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookManagedUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revision_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revision_get.py deleted file mode 100644 index 6795952f9b4c..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revision_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_revision_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.revision_get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - revision_id="1e2f8435b98248febee70c64ac22e1ab", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookRevisionGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revisions_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revisions_list.py deleted file mode 100644 index 31d5d3784023..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_revisions_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_revisions_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.revisions_list( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookRevisionsList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_update.py deleted file mode 100644 index dc7c74be517c..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbook_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbookUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list.py deleted file mode 100644 index 6d50230d7c3a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbooks_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.list_by_resource_group( - resource_group_name="my-resource-group", - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbooksList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list2.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list2.py deleted file mode 100644 index 180b80577472..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list2.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbooks_list2.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.list_by_subscription( - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbooksList2.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list_sub.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list_sub.py deleted file mode 100644 index 487e59aa62d4..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_list_sub.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbooks_list_sub.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.list_by_subscription( - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbooksListSub.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_managed_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_managed_list.py deleted file mode 100644 index dec87f1a82d5..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_08_01/workbooks_managed_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_08_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbooks_managed_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac119r124af", - ) - - response = client.workbooks.list_by_resource_group( - resource_group_name="my-resource-group", - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-08-01/examples/WorkbooksManagedList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_10/live_token_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_10/live_token_get.py deleted file mode 100644 index f9e9221bff09..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2021_10/live_token_get.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2021_10 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python live_token_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - ) - - response = client.live_token.get( - resource_uri="subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/FabrikamFiberApp/providers/microsoft.insights/components/CustomAvailabilityTest/providers/microsoft.insights/generatelivetoken", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2021-10-14/examples/LiveTokenGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_add.py deleted file mode 100644 index 788ce9628ed5..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_add.py +++ /dev/null @@ -1,54 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_add.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.create_or_update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - workbook_properties={ - "kind": "shared", - "location": "westus", - "properties": { - "category": "workbook", - "description": "Sample workbook", - "displayName": "Sample workbook", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":"{"json":"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook. This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe\'ve included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections."}","halfWidth":null,"conditionalVisibility":null},{"type":3,"content":"{"version":"KqlItem/1.0","query":"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart","showQuery":false,"size":1,"aggregation":0,"showAnnotations":false}","halfWidth":null,"conditionalVisibility":null}],"isLocked":false}', - }, - "tags": {"TagSample01": "sample01", "TagSample02": "sample02"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookAdd.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_delete.py deleted file mode 100644 index cb8cdbb712b7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - client.workbooks.delete( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get.py deleted file mode 100644 index 17c9e2e530d3..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get1.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get1.py deleted file mode 100644 index cb0683ddecee..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_get1.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_get1.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookGet1.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_add.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_add.py deleted file mode 100644 index 372e3605bf57..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_add.py +++ /dev/null @@ -1,61 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_managed_add.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.create_or_update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - workbook_properties={ - "identity": { - "type": "UserAssigned", - "userAssignedIdentities": { - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-resource-group/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myid": {} - }, - }, - "kind": "shared", - "location": "westus", - "properties": { - "category": "workbook", - "description": "Sample workbook", - "displayName": "Sample workbook", - "serializedData": '{"version":"Notebook/1.0","items":[{"type":1,"content":{"json":"test"},"name":"text - 0"}],"isLocked":false,"fallbackResourceIds":["/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/my-resource-group"]}', - "storageUri": "/subscriptions/6b643656-33eb-422f-aee8-3ac145d124af/resourceGroups/my-resource-group/providers/Microsoft.Storage/storageAccounts/mystorage/blobServices/default/containers/mycontainer", - "version": "Notebook/1.0", - }, - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookManagedAdd.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_get.py deleted file mode 100644 index 4f01843a5817..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_managed_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookManagedGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_update.py deleted file mode 100644 index 08fa7f3733ab..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_managed_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_managed_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookManagedUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revision_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revision_get.py deleted file mode 100644 index eae5b9b73b26..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revision_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_revision_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.revision_get( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - revision_id="1e2f8435b98248febee70c64ac22e1ab", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookRevisionGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revisions_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revisions_list.py deleted file mode 100644 index 32cea41bae8f..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_revisions_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_revisions_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.revisions_list( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookRevisionsList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_update.py deleted file mode 100644 index 0646e502b0c7..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbook_update.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbook_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.update( - resource_group_name="my-resource-group", - resource_name="deadb33f-5e0d-4064-8ebb-1a4ed0313eb2", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbookUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list.py deleted file mode 100644 index 7a9ae403ca12..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbooks_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.list_by_resource_group( - resource_group_name="my-resource-group", - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbooksList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list2.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list2.py deleted file mode 100644 index 16ce603eee97..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list2.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbooks_list2.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.list_by_subscription( - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbooksList2.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list_sub.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list_sub.py deleted file mode 100644 index f2dac454326c..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_list_sub.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbooks_list_sub.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac145d124af", - ) - - response = client.workbooks.list_by_subscription( - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbooksListSub.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_managed_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_managed_list.py deleted file mode 100644 index 953feb38038b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_04_01/workbooks_managed_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python workbooks_managed_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="6b643656-33eb-422f-aee8-3ac119r124af", - ) - - response = client.workbooks.list_by_resource_group( - resource_group_name="my-resource-group", - category="workbook", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-04-01/examples/WorkbooksManagedList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create.py deleted file mode 100644 index 74c2c867a5bf..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.create_or_update( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_definition={ - "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "str", - "Locations": [{"Id": "str"}], - "Name": "str", - "Request": { - "FollowRedirects": bool, - "Headers": [{"key": "str", "value": "str"}], - "HttpVerb": "str", - "ParseDependentRequests": bool, - "RequestBody": "str", - "RequestUrl": "str", - }, - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "ValidationRules": { - "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, - "ExpectedHttpStatusCode": 0, - "IgnoreHttpStatusCode": bool, - "SSLCertRemainingLifetimeCheck": 0, - "SSLCheck": bool, - }, - "id": "str", - "kind": "str", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create_standard.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create_standard.py deleted file mode 100644 index a923b38a1ba8..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_create_standard.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_create_standard.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.create_or_update( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_definition={ - "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "str", - "Locations": [{"Id": "str"}], - "Name": "str", - "Request": { - "FollowRedirects": bool, - "Headers": [{"key": "str", "value": "str"}], - "HttpVerb": "str", - "ParseDependentRequests": bool, - "RequestBody": "str", - "RequestUrl": "str", - }, - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "ValidationRules": { - "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, - "ExpectedHttpStatusCode": 0, - "IgnoreHttpStatusCode": bool, - "SSLCertRemainingLifetimeCheck": 0, - "SSLCheck": bool, - }, - "id": "str", - "kind": "str", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestCreateStandard.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_delete.py deleted file mode 100644 index 233839177564..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - client.web_tests.delete( - resource_group_name="my-resource-group", - web_test_name="my-webtest-01-mywebservice", - ) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_get.py deleted file mode 100644 index 4cf51226517e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.get( - resource_group_name="my-resource-group", - web_test_name="my-webtest-01-mywebservice", - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestGet.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list.py deleted file mode 100644 index c2caa44cd34e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list.py +++ /dev/null @@ -1,41 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestList.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_component.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_component.py deleted file mode 100644 index 73b58819c401..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_component.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_list_by_component.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.list_by_component( - component_name="my-component", - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestListByComponent.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_resource_group.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_resource_group.py deleted file mode 100644 index 2c4ef23c945e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_list_by_resource_group.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_list_by_resource_group.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.list_by_resource_group( - resource_group_name="my-resource-group", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestListByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update.py deleted file mode 100644 index 6c2ec146872f..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.create_or_update( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_definition={ - "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "str", - "Locations": [{"Id": "str"}], - "Name": "str", - "Request": { - "FollowRedirects": bool, - "Headers": [{"key": "str", "value": "str"}], - "HttpVerb": "str", - "ParseDependentRequests": bool, - "RequestBody": "str", - "RequestUrl": "str", - }, - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "ValidationRules": { - "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, - "ExpectedHttpStatusCode": 0, - "IgnoreHttpStatusCode": bool, - "SSLCertRemainingLifetimeCheck": 0, - "SSLCheck": bool, - }, - "id": "str", - "kind": "str", - "name": "str", - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update_tags_only.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update_tags_only.py deleted file mode 100644 index e1eae593301a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2022_06_15/web_test_update_tags_only.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-applicationinsights -# USAGE - python web_test_update_tags_only.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ApplicationInsightsManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.web_tests.update_tags( - resource_group_name="my-resource-group", - web_test_name="my-webtest-my-component", - web_test_tags={"tags": {"str": "str"}}, - ) - print(response) - - -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2022-06-15/examples/WebTestUpdateTagsOnly.json -if __name__ == "__main__": - main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_locations_list.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_locations_list.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_locations_list.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_locations_list.py index b4ca721b3a13..9669eac22cf4 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/web_test_locations_list.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/web_test_locations_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.web_test_locations.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WebTestLocationsList.json +# x-ms-original-file: 2015-05-01/WebTestLocationsList.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_create.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_create.py similarity index 63% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_create.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_create.py index 6f5998b7a8d4..404843283dc3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_create.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_create.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,22 +28,22 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.work_item_configurations.create( resource_group_name="my-resource-group", resource_name="my-component", work_item_configuration_properties={ - "ConnectorDataConfiguration": "str", - "ConnectorId": "str", - "ValidateOnly": bool, - "WorkItemProperties": {"str": "str"}, + "ConnectorDataConfiguration": '{"VSOAccountBaseUrl":"https://testtodelete.visualstudio.com","ProjectCollection":"DefaultCollection","Project":"todeletefirst","ResourceId":"d0662b05-439a-4a1b-840b-33a7f8b42ebf","Custom":"{\\"/fields/System.WorkItemType\\":\\"Bug\\",\\"/fields/System.AreaPath\\":\\"todeletefirst\\",\\"/fields/System.AssignedTo\\":\\"\\"}"}', + "ConnectorId": "d334e2a4-6733-488e-8645-a9fdc1694f41", + "ValidateOnly": True, + "WorkItemProperties": {"name": "Title", "value": "Validate Only Title"}, }, ) print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigCreate.json +# x-ms-original-file: 2015-05-01/WorkItemConfigCreate.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_default_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_default_get.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_default_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_default_get.py index c25b36e6e383..330fd6b845b3 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_default_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_default_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.work_item_configurations.get_default( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigDefaultGet.json +# x-ms-original-file: 2015-05-01/WorkItemConfigDefaultGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_delete.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_delete.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_delete.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_delete.py index ad520caaeeba..f7c9ea050d89 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_delete.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.work_item_configurations.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigDelete.json +# x-ms-original-file: 2015-05-01/WorkItemConfigDelete.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_get.py similarity index 78% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_get.py index b90af2026cdb..44dcfecffeca 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.work_item_configurations.get_item( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigGet.json +# x-ms-original-file: 2015-05-01/WorkItemConfigGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_update.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_update.py similarity index 64% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_update.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_update.py index 491bd6873831..c5762f3fa7a0 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_config_update.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_config_update.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +28,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.work_item_configurations.update_item( @@ -36,15 +36,15 @@ def main(): resource_name="my-component", work_item_config_id="Visual Studio Team Services", work_item_configuration_properties={ - "ConnectorDataConfiguration": "str", - "ConnectorId": "str", - "ValidateOnly": bool, - "WorkItemProperties": {"str": "str"}, + "ConnectorDataConfiguration": '{"VSOAccountBaseUrl":"https://testtodelete.visualstudio.com","ProjectCollection":"DefaultCollection","Project":"todeletefirst","ResourceId":"d0662b05-439a-4a1b-840b-33a7f8b42ebf","Custom":"{\\"/fields/System.WorkItemType\\":\\"Bug\\",\\"/fields/System.AreaPath\\":\\"todeletefirst\\",\\"/fields/System.AssignedTo\\":\\"\\"}"}', + "ConnectorId": "d334e2a4-6733-488e-8645-a9fdc1694f41", + "ValidateOnly": True, + "WorkItemProperties": {"name": "Title", "value": "Validate Only Title"}, }, ) print(response) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigUpdate.json +# x-ms-original-file: 2015-05-01/WorkItemConfigUpdate.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_configs_get.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_configs_get.py similarity index 77% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_configs_get.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_configs_get.py index 15e84f5dcebb..9d104ef88c88 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/v2015_05_01/work_item_configs_get.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_samples/work_item_configs_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient """ # PREREQUISITES @@ -28,7 +27,7 @@ def main(): client = ApplicationInsightsManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.work_item_configurations.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/examples/WorkItemConfigsGet.json +# x-ms-original-file: 2015-05-01/WorkItemConfigsGet.json if __name__ == "__main__": main() diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/conftest.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/conftest.py index b29928c7983b..24baecafa9a2 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/conftest.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations.py index 3789c95cfd52..f3ac6c2f20bc 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations_async.py index d9b9397f2f91..d4f95ad16b3a 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_analytics_items_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations.py index 7c8f8d069b43..90edf09b0ee1 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -44,7 +44,7 @@ def test_annotations_create(self, resource_group): "EventTime": "2020-02-20 00:00:00", "Id": "str", "Properties": "str", - "RelatedAnnotation": "null", + "RelatedAnnotation": "str", }, api_version="2015-05-01", ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations_async.py index 8b8e4b082617..cc13af678d36 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_annotations_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -45,7 +45,7 @@ async def test_annotations_create(self, resource_group): "EventTime": "2020-02-20 00:00:00", "Id": "str", "Properties": "str", - "RelatedAnnotation": "null", + "RelatedAnnotation": "str", }, api_version="2015-05-01", ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations.py index d6b49921afae..07384596c295 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations_async.py index 9c9777a23354..351ee7ac8bdc 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_api_keys_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations.py index 358f8982eefd..b3af0c286991 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations_async.py index 255a8c73351f..c3a43d2d6d99 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_available_features_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations.py index fa14e651937c..dc592c7e286f 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations_async.py index 96f58c8cb87f..1058bcd67a14 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_billing_features_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations.py deleted file mode 100644 index ccb04d9e731b..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations.py +++ /dev/null @@ -1,79 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient - -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 TestApplicationInsightsManagementComponentCurrentPricingPlanOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_component_current_pricing_plan_get(self, resource_group): - response = self.client.component_current_pricing_plan.get( - resource_group_name=resource_group.name, - resource_name="str", - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_component_current_pricing_plan_create_and_update(self, resource_group): - response = self.client.component_current_pricing_plan.create_and_update( - resource_group_name=resource_group.name, - resource_name="str", - pricing_plan_properties={ - "cap": 0.0, - "id": "str", - "maxHistoryCap": 0.0, - "name": "str", - "planType": "str", - "resetHour": 0, - "stopSendNotificationWhenHitCap": bool, - "stopSendNotificationWhenHitThreshold": bool, - "type": "str", - "warningThreshold": 0, - }, - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_component_current_pricing_plan_update(self, resource_group): - response = self.client.component_current_pricing_plan.update( - resource_group_name=resource_group.name, - resource_name="str", - pricing_plan_properties={ - "cap": 0.0, - "id": "str", - "maxHistoryCap": 0.0, - "name": "str", - "planType": "str", - "resetHour": 0, - "stopSendNotificationWhenHitCap": bool, - "stopSendNotificationWhenHitThreshold": bool, - "type": "str", - "warningThreshold": 0, - }, - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations_async.py deleted file mode 100644 index 6c006218232e..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_current_pricing_plan_operations_async.py +++ /dev/null @@ -1,80 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.applicationinsights.v2017_10_01.aio import ApplicationInsightsManagementClient - -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 TestApplicationInsightsManagementComponentCurrentPricingPlanOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_component_current_pricing_plan_get(self, resource_group): - response = await self.client.component_current_pricing_plan.get( - resource_group_name=resource_group.name, - resource_name="str", - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_component_current_pricing_plan_create_and_update(self, resource_group): - response = await self.client.component_current_pricing_plan.create_and_update( - resource_group_name=resource_group.name, - resource_name="str", - pricing_plan_properties={ - "cap": 0.0, - "id": "str", - "maxHistoryCap": 0.0, - "name": "str", - "planType": "str", - "resetHour": 0, - "stopSendNotificationWhenHitCap": bool, - "stopSendNotificationWhenHitThreshold": bool, - "type": "str", - "warningThreshold": 0, - }, - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_component_current_pricing_plan_update(self, resource_group): - response = await self.client.component_current_pricing_plan.update( - resource_group_name=resource_group.name, - resource_name="str", - pricing_plan_properties={ - "cap": 0.0, - "id": "str", - "maxHistoryCap": 0.0, - "name": "str", - "planType": "str", - "resetHour": 0, - "stopSendNotificationWhenHitCap": bool, - "stopSendNotificationWhenHitThreshold": bool, - "type": "str", - "warningThreshold": 0, - }, - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations.py index 8257d0d3ed78..d75b74e970d2 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations_async.py index cdb8cf0d7ede..8ed43cc29681 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_feature_capabilities_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations.py index 9ec8edf8baab..6cc5146cddfd 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2020_03_01_preview import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -40,8 +40,16 @@ def test_component_linked_storage_accounts_create_and_update(self, resource_grou storage_type="str", linked_storage_accounts_properties={ "id": "str", - "linkedStorageAccount": "str", "name": "str", + "properties": {"linkedStorageAccount": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "type": "str", }, api_version="2020-03-01-preview", @@ -57,7 +65,7 @@ def test_component_linked_storage_accounts_update(self, resource_group): resource_group_name=resource_group.name, resource_name="str", storage_type="str", - linked_storage_accounts_properties={"linkedStorageAccount": "str"}, + linked_storage_accounts_properties={"properties": {"linkedStorageAccount": "str"}}, api_version="2020-03-01-preview", ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations_async.py index b7b68502f93e..85369f2ffdb4 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_linked_storage_accounts_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2020_03_01_preview.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -41,8 +41,16 @@ async def test_component_linked_storage_accounts_create_and_update(self, resourc storage_type="str", linked_storage_accounts_properties={ "id": "str", - "linkedStorageAccount": "str", "name": "str", + "properties": {"linkedStorageAccount": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, "type": "str", }, api_version="2020-03-01-preview", @@ -58,7 +66,7 @@ async def test_component_linked_storage_accounts_update(self, resource_group): resource_group_name=resource_group.name, resource_name="str", storage_type="str", - linked_storage_accounts_properties={"linkedStorageAccount": "str"}, + linked_storage_accounts_properties={"properties": {"linkedStorageAccount": "str"}}, api_version="2020-03-01-preview", ) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations.py index de58b62c62e0..3824c8963c30 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations_async.py index 290b56bca3e5..ba4c9dcda7c2 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_component_quota_status_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations.py index e14ece288fcb..81b43ca9a667 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2020_02_02 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -20,31 +20,71 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_components_list(self, resource_group): - response = self.client.components.list( + def test_components_get(self, resource_group): + response = self.client.components.get( + resource_group_name=resource_group.name, + resource_name="str", api_version="2020-02-02", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_components_list_by_resource_group(self, resource_group): - response = self.client.components.list_by_resource_group( + def test_components_create_or_update(self, resource_group): + response = self.client.components.create_or_update( resource_group_name=resource_group.name, + resource_name="str", + insight_properties={ + "kind": "str", + "location": "str", + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "Application_Type": "str", + "AppId": "str", + "ApplicationId": "str", + "ConnectionString": "str", + "CreationDate": "2020-02-20 00:00:00", + "DisableIpMasking": bool, + "DisableLocalAuth": bool, + "Flow_Type": "str", + "ForceCustomerStorageForProfiler": bool, + "HockeyAppId": "str", + "HockeyAppToken": "str", + "ImmediatePurgeDataOn30Days": bool, + "IngestionMode": "str", + "InstrumentationKey": "str", + "LaMigrationDate": "2020-02-20 00:00:00", + "Name": "str", + "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], + "Request_Source": "str", + "RetentionInDays": 0, + "SamplingPercentage": 0.0, + "TenantId": "str", + "WorkspaceResourceId": "str", + "provisioningState": "str", + "publicNetworkAccessForIngestion": "str", + "publicNetworkAccessForQuery": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, api_version="2020-02-02", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_components_delete(self, resource_group): - response = self.client.components.delete( + def test_components_update_tags(self, resource_group): + response = self.client.components.update_tags( resource_group_name=resource_group.name, resource_name="str", + component_tags={"tags": {"str": "str"}}, api_version="2020-02-02", ) @@ -53,8 +93,8 @@ def test_components_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_components_get(self, resource_group): - response = self.client.components.get( + def test_components_delete(self, resource_group): + response = self.client.components.delete( resource_group_name=resource_group.name, resource_name="str", api_version="2020-02-02", @@ -65,60 +105,22 @@ def test_components_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_components_create_or_update(self, resource_group): - response = self.client.components.create_or_update( + def test_components_list_by_resource_group(self, resource_group): + response = self.client.components.list_by_resource_group( resource_group_name=resource_group.name, - resource_name="str", - insight_properties={ - "kind": "str", - "location": "str", - "AppId": "str", - "ApplicationId": "str", - "Application_Type": "web", - "ConnectionString": "str", - "CreationDate": "2020-02-20 00:00:00", - "DisableIpMasking": bool, - "DisableLocalAuth": bool, - "Flow_Type": "Bluefield", - "ForceCustomerStorageForProfiler": bool, - "HockeyAppId": "str", - "HockeyAppToken": "str", - "ImmediatePurgeDataOn30Days": bool, - "IngestionMode": "LogAnalytics", - "InstrumentationKey": "str", - "LaMigrationDate": "2020-02-20 00:00:00", - "Name": "str", - "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], - "Request_Source": "rest", - "RetentionInDays": 0, - "SamplingPercentage": 0.0, - "TenantId": "str", - "WorkspaceResourceId": "str", - "etag": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "publicNetworkAccessForIngestion": "Enabled", - "publicNetworkAccessForQuery": "Enabled", - "tags": {"str": "str"}, - "type": "str", - }, api_version="2020-02-02", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_components_update_tags(self, resource_group): - response = self.client.components.update_tags( - resource_group_name=resource_group.name, - resource_name="str", - component_tags={"tags": {"str": "str"}}, + def test_components_list(self, resource_group): + response = self.client.components.list( api_version="2020-02-02", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations_async.py index 1c7fa192a257..f7e88715c9f0 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_components_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2020_02_02.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -21,31 +21,71 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_components_list(self, resource_group): - response = self.client.components.list( + async def test_components_get(self, resource_group): + response = await self.client.components.get( + resource_group_name=resource_group.name, + resource_name="str", api_version="2020-02-02", ) - 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_components_list_by_resource_group(self, resource_group): - response = self.client.components.list_by_resource_group( + async def test_components_create_or_update(self, resource_group): + response = await self.client.components.create_or_update( resource_group_name=resource_group.name, + resource_name="str", + insight_properties={ + "kind": "str", + "location": "str", + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "Application_Type": "str", + "AppId": "str", + "ApplicationId": "str", + "ConnectionString": "str", + "CreationDate": "2020-02-20 00:00:00", + "DisableIpMasking": bool, + "DisableLocalAuth": bool, + "Flow_Type": "str", + "ForceCustomerStorageForProfiler": bool, + "HockeyAppId": "str", + "HockeyAppToken": "str", + "ImmediatePurgeDataOn30Days": bool, + "IngestionMode": "str", + "InstrumentationKey": "str", + "LaMigrationDate": "2020-02-20 00:00:00", + "Name": "str", + "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], + "Request_Source": "str", + "RetentionInDays": 0, + "SamplingPercentage": 0.0, + "TenantId": "str", + "WorkspaceResourceId": "str", + "provisioningState": "str", + "publicNetworkAccessForIngestion": "str", + "publicNetworkAccessForQuery": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, api_version="2020-02-02", ) - 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_components_delete(self, resource_group): - response = await self.client.components.delete( + async def test_components_update_tags(self, resource_group): + response = await self.client.components.update_tags( resource_group_name=resource_group.name, resource_name="str", + component_tags={"tags": {"str": "str"}}, api_version="2020-02-02", ) @@ -54,8 +94,8 @@ async def test_components_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_components_get(self, resource_group): - response = await self.client.components.get( + async def test_components_delete(self, resource_group): + response = await self.client.components.delete( resource_group_name=resource_group.name, resource_name="str", api_version="2020-02-02", @@ -66,60 +106,22 @@ async def test_components_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_components_create_or_update(self, resource_group): - response = await self.client.components.create_or_update( + async def test_components_list_by_resource_group(self, resource_group): + response = self.client.components.list_by_resource_group( resource_group_name=resource_group.name, - resource_name="str", - insight_properties={ - "kind": "str", - "location": "str", - "AppId": "str", - "ApplicationId": "str", - "Application_Type": "web", - "ConnectionString": "str", - "CreationDate": "2020-02-20 00:00:00", - "DisableIpMasking": bool, - "DisableLocalAuth": bool, - "Flow_Type": "Bluefield", - "ForceCustomerStorageForProfiler": bool, - "HockeyAppId": "str", - "HockeyAppToken": "str", - "ImmediatePurgeDataOn30Days": bool, - "IngestionMode": "LogAnalytics", - "InstrumentationKey": "str", - "LaMigrationDate": "2020-02-20 00:00:00", - "Name": "str", - "PrivateLinkScopedResources": [{"ResourceId": "str", "ScopeId": "str"}], - "Request_Source": "rest", - "RetentionInDays": 0, - "SamplingPercentage": 0.0, - "TenantId": "str", - "WorkspaceResourceId": "str", - "etag": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "publicNetworkAccessForIngestion": "Enabled", - "publicNetworkAccessForQuery": "Enabled", - "tags": {"str": "str"}, - "type": "str", - }, api_version="2020-02-02", ) - + 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_components_update_tags(self, resource_group): - response = await self.client.components.update_tags( - resource_group_name=resource_group.name, - resource_name="str", - component_tags={"tags": {"str": "str"}}, + async def test_components_list(self, resource_group): + response = self.client.components.list( api_version="2020-02-02", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_deleted_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_deleted_workbooks_operations.py index 4097b33a2474..4655ccb96fab 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_deleted_workbooks_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_deleted_workbooks_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_deleted_workbooks_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_deleted_workbooks_operations_async.py index bb98c3e4628d..f30c928e44c5 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_deleted_workbooks_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_deleted_workbooks_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations.py deleted file mode 100644 index 200f8b3328b4..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient - -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 TestApplicationInsightsManagementEASubscriptionListMigrationDateOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_ea_subscription_list_migration_date_post(self, resource_group): - response = self.client.ea_subscription_list_migration_date.post( - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations_async.py deleted file mode 100644 index eef360de523c..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_list_migration_date_operations_async.py +++ /dev/null @@ -1,30 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.applicationinsights.v2017_10_01.aio import ApplicationInsightsManagementClient - -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 TestApplicationInsightsManagementEASubscriptionListMigrationDateOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_ea_subscription_list_migration_date_post(self, resource_group): - response = await self.client.ea_subscription_list_migration_date.post( - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations.py deleted file mode 100644 index 30b13c911ea9..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient - -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 TestApplicationInsightsManagementEASubscriptionMigrateToNewPricingModelOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_ea_subscription_migrate_to_new_pricing_model_post(self, resource_group): - response = self.client.ea_subscription_migrate_to_new_pricing_model.post( - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations_async.py deleted file mode 100644 index 0c9f3c89581a..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_migrate_to_new_pricing_model_operations_async.py +++ /dev/null @@ -1,30 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.applicationinsights.v2017_10_01.aio import ApplicationInsightsManagementClient - -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 TestApplicationInsightsManagementEASubscriptionMigrateToNewPricingModelOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_ea_subscription_migrate_to_new_pricing_model_post(self, resource_group): - response = await self.client.ea_subscription_migrate_to_new_pricing_model.post( - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations.py deleted file mode 100644 index 4593d2df0681..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations.py +++ /dev/null @@ -1,29 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.applicationinsights.v2017_10_01 import ApplicationInsightsManagementClient - -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 TestApplicationInsightsManagementEASubscriptionRollbackToLegacyPricingModelOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_ea_subscription_rollback_to_legacy_pricing_model_post(self, resource_group): - response = self.client.ea_subscription_rollback_to_legacy_pricing_model.post( - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations_async.py deleted file mode 100644 index 45e5204fc2ce..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_ea_subscription_rollback_to_legacy_pricing_model_operations_async.py +++ /dev/null @@ -1,32 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.applicationinsights.v2017_10_01.aio import ApplicationInsightsManagementClient - -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 TestApplicationInsightsManagementEASubscriptionRollbackToLegacyPricingModelOperationsAsync( - AzureMgmtRecordedTestCase -): - def setup_method(self, method): - self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_ea_subscription_rollback_to_legacy_pricing_model_post(self, resource_group): - response = await self.client.ea_subscription_rollback_to_legacy_pricing_model.post( - api_version="2017-10-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations.py index f721fee6dd1d..8c4657c27a37 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations_async.py index 8b2c97293086..85723afccd18 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_export_configurations_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations.py index abeed3b3b73f..1976bc5ad9ef 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations_async.py index ca18d944c2da..5539c937a185 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_favorites_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations.py index 817f653fa6b3..6ac8a063fa07 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2021_10 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations_async.py index 43ccaa95396d..5d93a323b0e8 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_live_token_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2021_10.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations.py deleted file mode 100644 index ea1835f8fa5c..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations.py +++ /dev/null @@ -1,142 +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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.applicationinsights.v2021_03_08 import ApplicationInsightsManagementClient - -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 TestApplicationInsightsManagementMyWorkbooksOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_my_workbooks_list_by_resource_group(self, resource_group): - response = self.client.my_workbooks.list_by_resource_group( - resource_group_name=resource_group.name, - category="str", - api_version="2021-03-08", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_my_workbooks_list_by_subscription(self, resource_group): - response = self.client.my_workbooks.list_by_subscription( - category="str", - api_version="2021-03-08", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_my_workbooks_get(self, resource_group): - response = self.client.my_workbooks.get( - resource_group_name=resource_group.name, - resource_name="str", - api_version="2021-03-08", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_my_workbooks_delete(self, resource_group): - response = self.client.my_workbooks.delete( - resource_group_name=resource_group.name, - resource_name="str", - api_version="2021-03-08", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_my_workbooks_create_or_update(self, resource_group): - response = self.client.my_workbooks.create_or_update( - resource_group_name=resource_group.name, - resource_name="str", - workbook_properties={ - "category": "str", - "displayName": "str", - "etag": {"str": "str"}, - "id": "str", - "identity": {"type": "str", "userAssignedIdentities": {"principalId": "str", "tenantId": "str"}}, - "kind": "str", - "location": "str", - "name": "str", - "serializedData": "str", - "sourceId": "str", - "storageUri": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": ["str"], - "timeModified": "str", - "type": "str", - "userId": "str", - "version": "str", - }, - api_version="2021-03-08", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_my_workbooks_update(self, resource_group): - response = self.client.my_workbooks.update( - resource_group_name=resource_group.name, - resource_name="str", - workbook_properties={ - "category": "str", - "displayName": "str", - "etag": {"str": "str"}, - "id": "str", - "identity": {"type": "str", "userAssignedIdentities": {"principalId": "str", "tenantId": "str"}}, - "kind": "str", - "location": "str", - "name": "str", - "serializedData": "str", - "sourceId": "str", - "storageUri": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": ["str"], - "timeModified": "str", - "type": "str", - "userId": "str", - "version": "str", - }, - api_version="2021-03-08", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations_async.py deleted file mode 100644 index 9a6ce92a6bdd..000000000000 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_my_workbooks_operations_async.py +++ /dev/null @@ -1,143 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.applicationinsights.v2021_03_08.aio import ApplicationInsightsManagementClient - -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 TestApplicationInsightsManagementMyWorkbooksOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_my_workbooks_list_by_resource_group(self, resource_group): - response = self.client.my_workbooks.list_by_resource_group( - resource_group_name=resource_group.name, - category="str", - api_version="2021-03-08", - ) - 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_my_workbooks_list_by_subscription(self, resource_group): - response = self.client.my_workbooks.list_by_subscription( - category="str", - api_version="2021-03-08", - ) - 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_my_workbooks_get(self, resource_group): - response = await self.client.my_workbooks.get( - resource_group_name=resource_group.name, - resource_name="str", - api_version="2021-03-08", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_my_workbooks_delete(self, resource_group): - response = await self.client.my_workbooks.delete( - resource_group_name=resource_group.name, - resource_name="str", - api_version="2021-03-08", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_my_workbooks_create_or_update(self, resource_group): - response = await self.client.my_workbooks.create_or_update( - resource_group_name=resource_group.name, - resource_name="str", - workbook_properties={ - "category": "str", - "displayName": "str", - "etag": {"str": "str"}, - "id": "str", - "identity": {"type": "str", "userAssignedIdentities": {"principalId": "str", "tenantId": "str"}}, - "kind": "str", - "location": "str", - "name": "str", - "serializedData": "str", - "sourceId": "str", - "storageUri": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": ["str"], - "timeModified": "str", - "type": "str", - "userId": "str", - "version": "str", - }, - api_version="2021-03-08", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_my_workbooks_update(self, resource_group): - response = await self.client.my_workbooks.update( - resource_group_name=resource_group.name, - resource_name="str", - workbook_properties={ - "category": "str", - "displayName": "str", - "etag": {"str": "str"}, - "id": "str", - "identity": {"type": "str", "userAssignedIdentities": {"principalId": "str", "tenantId": "str"}}, - "kind": "str", - "location": "str", - "name": "str", - "serializedData": "str", - "sourceId": "str", - "storageUri": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": ["str"], - "timeModified": "str", - "type": "str", - "userId": "str", - "version": "str", - }, - api_version="2021-03-08", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations.py index be4b197e11e1..d2f3475fea16 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2020_06_02_preview import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2020-06-02-preview", + api_version="2021-03-08", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations_async.py index 2526f05107dc..f2321a93fb48 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2020_06_02_preview.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2020-06-02-preview", + api_version="2021-03-08", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations.py index 57b734fdd9d6..a7d512db5054 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2018_05_01_preview import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -24,7 +24,7 @@ def test_proactive_detection_configurations_list(self, resource_group): response = self.client.proactive_detection_configurations.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2018-05-01-preview", + api_version="2015-05-01", ) # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_proactive_detection_configurations_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", configuration_id="str", - api_version="2018-05-01-preview", + api_version="2015-05-01", ) # please add some check logic here by yourself @@ -51,11 +51,11 @@ def test_proactive_detection_configurations_update(self, resource_group): resource_name="str", configuration_id="str", proactive_detection_properties={ - "CustomEmails": ["str"], - "Enabled": bool, - "LastUpdatedTime": "str", - "Name": "str", - "RuleDefinitions": { + "customEmails": ["str"], + "enabled": bool, + "lastUpdatedTime": "str", + "name": "str", + "ruleDefinitions": { "Description": "str", "DisplayName": "str", "HelpUrl": "str", @@ -65,13 +65,9 @@ def test_proactive_detection_configurations_update(self, resource_group): "Name": "str", "SupportsEmailNotifications": bool, }, - "SendEmailsToSubscriptionOwners": bool, - "id": "str", - "location": "str", - "name": "str", - "type": "str", + "sendEmailsToSubscriptionOwners": bool, }, - api_version="2018-05-01-preview", + api_version="2015-05-01", ) # please add some check logic here by yourself diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations_async.py index 590a5b6d8908..a48d5fa71662 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_proactive_detection_configurations_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2018_05_01_preview.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -25,7 +25,7 @@ async def test_proactive_detection_configurations_list(self, resource_group): response = await self.client.proactive_detection_configurations.list( resource_group_name=resource_group.name, resource_name="str", - api_version="2018-05-01-preview", + api_version="2015-05-01", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_proactive_detection_configurations_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", configuration_id="str", - api_version="2018-05-01-preview", + api_version="2015-05-01", ) # please add some check logic here by yourself @@ -52,11 +52,11 @@ async def test_proactive_detection_configurations_update(self, resource_group): resource_name="str", configuration_id="str", proactive_detection_properties={ - "CustomEmails": ["str"], - "Enabled": bool, - "LastUpdatedTime": "str", - "Name": "str", - "RuleDefinitions": { + "customEmails": ["str"], + "enabled": bool, + "lastUpdatedTime": "str", + "name": "str", + "ruleDefinitions": { "Description": "str", "DisplayName": "str", "HelpUrl": "str", @@ -66,13 +66,9 @@ async def test_proactive_detection_configurations_update(self, resource_group): "Name": "str", "SupportsEmailNotifications": bool, }, - "SendEmailsToSubscriptionOwners": bool, - "id": "str", - "location": "str", - "name": "str", - "type": "str", + "sendEmailsToSubscriptionOwners": bool, }, - api_version="2018-05-01-preview", + api_version="2015-05-01", ) # please add some check logic here by yourself diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations.py index cfb105935cc5..769415dcf300 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2022_06_15 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,17 +18,6 @@ class TestApplicationInsightsManagementWebTestsOperations(AzureMgmtRecordedTestC def setup_method(self, method): self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_web_tests_list_by_resource_group(self, resource_group): - response = self.client.web_tests.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2022-06-15", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_web_tests_get(self, resource_group): @@ -49,35 +38,37 @@ def test_web_tests_create_or_update(self, resource_group): web_test_name="str", web_test_definition={ "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "str", - "Locations": [{"Id": "str"}], - "Name": "str", - "Request": { - "FollowRedirects": bool, - "Headers": [{"key": "str", "value": "str"}], - "HttpVerb": "str", - "ParseDependentRequests": bool, - "RequestBody": "str", - "RequestUrl": "str", - }, - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "ValidationRules": { - "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, - "ExpectedHttpStatusCode": 0, - "IgnoreHttpStatusCode": bool, - "SSLCertRemainingLifetimeCheck": 0, - "SSLCheck": bool, - }, "id": "str", "kind": "str", "name": "str", - "provisioningState": "str", + "properties": { + "Kind": "str", + "Locations": [{"Id": "str"}], + "Name": "str", + "SyntheticMonitorId": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 0, + "Request": { + "FollowRedirects": bool, + "Headers": [{"key": "str", "value": "str"}], + "HttpVerb": "str", + "ParseDependentRequests": bool, + "RequestBody": "str", + "RequestUrl": "str", + }, + "RetryEnabled": bool, + "Timeout": 0, + "ValidationRules": { + "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, + "ExpectedHttpStatusCode": 0, + "IgnoreHttpStatusCode": bool, + "SSLCertRemainingLifetimeCheck": 0, + "SSLCheck": bool, + }, + "provisioningState": "str", + }, "tags": {"str": "str"}, "type": "str", }, @@ -112,6 +103,17 @@ def test_web_tests_delete(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_web_tests_list_by_resource_group(self, resource_group): + response = self.client.web_tests.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2022-06-15", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_web_tests_list(self, resource_group): @@ -126,8 +128,8 @@ def test_web_tests_list(self, resource_group): @recorded_by_proxy def test_web_tests_list_by_component(self, resource_group): response = self.client.web_tests.list_by_component( - component_name="str", resource_group_name=resource_group.name, + component_name="str", api_version="2022-06-15", ) result = [r for r in response] diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations_async.py index d4c6688425b7..370c9affd566 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_tests_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2022_06_15.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,17 +19,6 @@ class TestApplicationInsightsManagementWebTestsOperationsAsync(AzureMgmtRecorded def setup_method(self, method): self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_web_tests_list_by_resource_group(self, resource_group): - response = self.client.web_tests.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2022-06-15", - ) - 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_web_tests_get(self, resource_group): @@ -50,35 +39,37 @@ async def test_web_tests_create_or_update(self, resource_group): web_test_name="str", web_test_definition={ "location": "str", - "Configuration": {"WebTest": "str"}, - "Description": "str", - "Enabled": bool, - "Frequency": 300, - "Kind": "str", - "Locations": [{"Id": "str"}], - "Name": "str", - "Request": { - "FollowRedirects": bool, - "Headers": [{"key": "str", "value": "str"}], - "HttpVerb": "str", - "ParseDependentRequests": bool, - "RequestBody": "str", - "RequestUrl": "str", - }, - "RetryEnabled": bool, - "SyntheticMonitorId": "str", - "Timeout": 30, - "ValidationRules": { - "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, - "ExpectedHttpStatusCode": 0, - "IgnoreHttpStatusCode": bool, - "SSLCertRemainingLifetimeCheck": 0, - "SSLCheck": bool, - }, "id": "str", "kind": "str", "name": "str", - "provisioningState": "str", + "properties": { + "Kind": "str", + "Locations": [{"Id": "str"}], + "Name": "str", + "SyntheticMonitorId": "str", + "Configuration": {"WebTest": "str"}, + "Description": "str", + "Enabled": bool, + "Frequency": 0, + "Request": { + "FollowRedirects": bool, + "Headers": [{"key": "str", "value": "str"}], + "HttpVerb": "str", + "ParseDependentRequests": bool, + "RequestBody": "str", + "RequestUrl": "str", + }, + "RetryEnabled": bool, + "Timeout": 0, + "ValidationRules": { + "ContentValidation": {"ContentMatch": "str", "IgnoreCase": bool, "PassIfTextFound": bool}, + "ExpectedHttpStatusCode": 0, + "IgnoreHttpStatusCode": bool, + "SSLCertRemainingLifetimeCheck": 0, + "SSLCheck": bool, + }, + "provisioningState": "str", + }, "tags": {"str": "str"}, "type": "str", }, @@ -113,6 +104,17 @@ async def test_web_tests_delete(self, resource_group): # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_web_tests_list_by_resource_group(self, resource_group): + response = self.client.web_tests.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2022-06-15", + ) + 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_web_tests_list(self, resource_group): @@ -127,8 +129,8 @@ async def test_web_tests_list(self, resource_group): @recorded_by_proxy_async async def test_web_tests_list_by_component(self, resource_group): response = self.client.web_tests.list_by_component( - component_name="str", resource_group_name=resource_group.name, + component_name="str", api_version="2022-06-15", ) result = [r async for r in response] diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations.py index 618ed330e37c..12f64e50dae9 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations_async.py index f8ac667b06ce..ab802138d8f4 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_work_item_configurations_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations.py index 2b4020d29d61..2e39b3df2cc9 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2020_11_20 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -20,21 +20,53 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_workbook_templates_list_by_resource_group(self, resource_group): - response = self.client.workbook_templates.list_by_resource_group( + def test_workbook_templates_get(self, resource_group): + response = self.client.workbook_templates.get( resource_group_name=resource_group.name, + resource_name="str", api_version="2020-11-20", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_workbook_templates_get(self, resource_group): - response = self.client.workbook_templates.get( + def test_workbook_templates_create_or_update(self, resource_group): + response = self.client.workbook_templates.create_or_update( resource_group_name=resource_group.name, resource_name="str", + workbook_template_properties={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "galleries": [{"category": "str", "name": "str", "order": 0, "resourceType": "str", "type": "str"}], + "templateData": {}, + "author": "str", + "localized": { + "str": [ + { + "galleries": [ + {"category": "str", "name": "str", "order": 0, "resourceType": "str", "type": "str"} + ], + "templateData": {}, + } + ] + }, + "priority": 0, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, api_version="2020-11-20", ) @@ -43,8 +75,8 @@ def test_workbook_templates_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_workbook_templates_delete(self, resource_group): - response = self.client.workbook_templates.delete( + def test_workbook_templates_update(self, resource_group): + response = self.client.workbook_templates.update( resource_group_name=resource_group.name, resource_name="str", api_version="2020-11-20", @@ -55,31 +87,10 @@ def test_workbook_templates_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_workbook_templates_create_or_update(self, resource_group): - response = self.client.workbook_templates.create_or_update( + def test_workbook_templates_delete(self, resource_group): + response = self.client.workbook_templates.delete( resource_group_name=resource_group.name, resource_name="str", - workbook_template_properties={ - "location": "str", - "author": "str", - "galleries": [{"category": "str", "name": "str", "order": 0, "resourceType": "str", "type": "str"}], - "id": "str", - "localized": { - "str": [ - { - "galleries": [ - {"category": "str", "name": "str", "order": 0, "resourceType": "str", "type": "str"} - ], - "templateData": {}, - } - ] - }, - "name": "str", - "priority": 0, - "tags": {"str": "str"}, - "templateData": {}, - "type": "str", - }, api_version="2020-11-20", ) @@ -88,12 +99,11 @@ def test_workbook_templates_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_workbook_templates_update(self, resource_group): - response = self.client.workbook_templates.update( + def test_workbook_templates_list_by_resource_group(self, resource_group): + response = self.client.workbook_templates.list_by_resource_group( resource_group_name=resource_group.name, - resource_name="str", api_version="2020-11-20", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations_async.py index 0e70e384fddc..878145fa2430 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbook_templates_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2020_11_20.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -21,21 +21,53 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_workbook_templates_list_by_resource_group(self, resource_group): - response = self.client.workbook_templates.list_by_resource_group( + async def test_workbook_templates_get(self, resource_group): + response = await self.client.workbook_templates.get( resource_group_name=resource_group.name, + resource_name="str", api_version="2020-11-20", ) - 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_workbook_templates_get(self, resource_group): - response = await self.client.workbook_templates.get( + async def test_workbook_templates_create_or_update(self, resource_group): + response = await self.client.workbook_templates.create_or_update( resource_group_name=resource_group.name, resource_name="str", + workbook_template_properties={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "galleries": [{"category": "str", "name": "str", "order": 0, "resourceType": "str", "type": "str"}], + "templateData": {}, + "author": "str", + "localized": { + "str": [ + { + "galleries": [ + {"category": "str", "name": "str", "order": 0, "resourceType": "str", "type": "str"} + ], + "templateData": {}, + } + ] + }, + "priority": 0, + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, api_version="2020-11-20", ) @@ -44,8 +76,8 @@ async def test_workbook_templates_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_workbook_templates_delete(self, resource_group): - response = await self.client.workbook_templates.delete( + async def test_workbook_templates_update(self, resource_group): + response = await self.client.workbook_templates.update( resource_group_name=resource_group.name, resource_name="str", api_version="2020-11-20", @@ -56,31 +88,10 @@ async def test_workbook_templates_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_workbook_templates_create_or_update(self, resource_group): - response = await self.client.workbook_templates.create_or_update( + async def test_workbook_templates_delete(self, resource_group): + response = await self.client.workbook_templates.delete( resource_group_name=resource_group.name, resource_name="str", - workbook_template_properties={ - "location": "str", - "author": "str", - "galleries": [{"category": "str", "name": "str", "order": 0, "resourceType": "str", "type": "str"}], - "id": "str", - "localized": { - "str": [ - { - "galleries": [ - {"category": "str", "name": "str", "order": 0, "resourceType": "str", "type": "str"} - ], - "templateData": {}, - } - ] - }, - "name": "str", - "priority": 0, - "tags": {"str": "str"}, - "templateData": {}, - "type": "str", - }, api_version="2020-11-20", ) @@ -89,12 +100,11 @@ async def test_workbook_templates_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_workbook_templates_update(self, resource_group): - response = await self.client.workbook_templates.update( + async def test_workbook_templates_list_by_resource_group(self, resource_group): + response = self.client.workbook_templates.list_by_resource_group( resource_group_name=resource_group.name, - resource_name="str", api_version="2020-11-20", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations.py index 971d032527e8..827d936aec16 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2022_04_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -18,48 +18,13 @@ class TestApplicationInsightsManagementWorkbooksOperations(AzureMgmtRecordedTest def setup_method(self, method): self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_workbooks_list_by_subscription(self, resource_group): - response = self.client.workbooks.list_by_subscription( - category="str", - api_version="2022-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_workbooks_list_by_resource_group(self, resource_group): - response = self.client.workbooks.list_by_resource_group( - resource_group_name=resource_group.name, - category="str", - api_version="2022-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_workbooks_get(self, resource_group): response = self.client.workbooks.get( resource_group_name=resource_group.name, resource_name="str", - api_version="2022-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_workbooks_delete(self, resource_group): - response = self.client.workbooks.delete( - resource_group_name=resource_group.name, - resource_name="str", - api_version="2022-04-01", + api_version="2023-06-01", ) # please add some check logic here by yourself @@ -73,9 +38,6 @@ def test_workbooks_create_or_update(self, resource_group): resource_name="str", workbook_properties={ "location": "str", - "category": "str", - "description": "str", - "displayName": "str", "etag": "str", "id": "str", "identity": { @@ -86,10 +48,19 @@ def test_workbooks_create_or_update(self, resource_group): }, "kind": "str", "name": "str", - "revision": "str", - "serializedData": "str", - "sourceId": "str", - "storageUri": "str", + "properties": { + "category": "str", + "displayName": "str", + "serializedData": "str", + "description": "str", + "revision": "str", + "sourceId": "str", + "storageUri": "str", + "tags": ["str"], + "timeModified": "2020-02-20 00:00:00", + "userId": "str", + "version": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -98,13 +69,10 @@ def test_workbooks_create_or_update(self, resource_group): "lastModifiedBy": "str", "lastModifiedByType": "str", }, - "tags": ["str"], - "timeModified": "2020-02-20 00:00:00", + "tags": {"str": "str"}, "type": "str", - "userId": "str", - "version": "str", }, - api_version="2022-04-01", + api_version="2023-06-01", ) # please add some check logic here by yourself @@ -116,19 +84,42 @@ def test_workbooks_update(self, resource_group): response = self.client.workbooks.update( resource_group_name=resource_group.name, resource_name="str", - api_version="2022-04-01", + api_version="2023-06-01", ) # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbooks_delete(self, resource_group): + response = self.client.workbooks.delete( + resource_group_name=resource_group.name, + resource_name="str", + api_version="2023-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbooks_list_by_subscription(self, resource_group): + response = self.client.workbooks.list_by_subscription( + category="str", + api_version="2023-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_workbooks_revisions_list(self, resource_group): response = self.client.workbooks.revisions_list( resource_group_name=resource_group.name, resource_name="str", - api_version="2022-04-01", + api_version="2023-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -141,8 +132,20 @@ def test_workbooks_revision_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", revision_id="str", - api_version="2022-04-01", + api_version="2023-06-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_workbooks_list_by_resource_group(self, resource_group): + response = self.client.workbooks.list_by_resource_group( + resource_group_name=resource_group.name, + category="str", + api_version="2023-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations_async.py index 033174c4aba4..743607b6e698 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_workbooks_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2022_04_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -19,48 +19,13 @@ class TestApplicationInsightsManagementWorkbooksOperationsAsync(AzureMgmtRecorde def setup_method(self, method): self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_workbooks_list_by_subscription(self, resource_group): - response = self.client.workbooks.list_by_subscription( - category="str", - api_version="2022-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_workbooks_list_by_resource_group(self, resource_group): - response = self.client.workbooks.list_by_resource_group( - resource_group_name=resource_group.name, - category="str", - api_version="2022-04-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_workbooks_get(self, resource_group): response = await self.client.workbooks.get( resource_group_name=resource_group.name, resource_name="str", - api_version="2022-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_workbooks_delete(self, resource_group): - response = await self.client.workbooks.delete( - resource_group_name=resource_group.name, - resource_name="str", - api_version="2022-04-01", + api_version="2023-06-01", ) # please add some check logic here by yourself @@ -74,9 +39,6 @@ async def test_workbooks_create_or_update(self, resource_group): resource_name="str", workbook_properties={ "location": "str", - "category": "str", - "description": "str", - "displayName": "str", "etag": "str", "id": "str", "identity": { @@ -87,10 +49,19 @@ async def test_workbooks_create_or_update(self, resource_group): }, "kind": "str", "name": "str", - "revision": "str", - "serializedData": "str", - "sourceId": "str", - "storageUri": "str", + "properties": { + "category": "str", + "displayName": "str", + "serializedData": "str", + "description": "str", + "revision": "str", + "sourceId": "str", + "storageUri": "str", + "tags": ["str"], + "timeModified": "2020-02-20 00:00:00", + "userId": "str", + "version": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -99,13 +70,10 @@ async def test_workbooks_create_or_update(self, resource_group): "lastModifiedBy": "str", "lastModifiedByType": "str", }, - "tags": ["str"], - "timeModified": "2020-02-20 00:00:00", + "tags": {"str": "str"}, "type": "str", - "userId": "str", - "version": "str", }, - api_version="2022-04-01", + api_version="2023-06-01", ) # please add some check logic here by yourself @@ -117,19 +85,42 @@ async def test_workbooks_update(self, resource_group): response = await self.client.workbooks.update( resource_group_name=resource_group.name, resource_name="str", - api_version="2022-04-01", + api_version="2023-06-01", ) # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbooks_delete(self, resource_group): + response = await self.client.workbooks.delete( + resource_group_name=resource_group.name, + resource_name="str", + api_version="2023-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbooks_list_by_subscription(self, resource_group): + response = self.client.workbooks.list_by_subscription( + category="str", + api_version="2023-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_workbooks_revisions_list(self, resource_group): response = self.client.workbooks.revisions_list( resource_group_name=resource_group.name, resource_name="str", - api_version="2022-04-01", + api_version="2023-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -142,8 +133,20 @@ async def test_workbooks_revision_get(self, resource_group): resource_group_name=resource_group.name, resource_name="str", revision_id="str", - api_version="2022-04-01", + api_version="2023-06-01", ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_workbooks_list_by_resource_group(self, resource_group): + response = self.client.workbooks.list_by_resource_group( + resource_group_name=resource_group.name, + category="str", + api_version="2023-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_managementweb_test_locations_operations.py similarity index 85% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_managementweb_test_locations_operations.py index 2601ee7ce413..6fadcea302db 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_managementweb_test_locations_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01 import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,7 +14,7 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestApplicationInsightsManagementWebTestLocationsOperations(AzureMgmtRecordedTestCase): +class TestApplicationInsightsManagementwebTestLocationsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ApplicationInsightsManagementClient) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations_async.py b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_managementweb_test_locations_operations_async.py similarity index 85% rename from sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations_async.py rename to sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_managementweb_test_locations_operations_async.py index cb8ed42ebd1f..5702afd12630 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_management_web_test_locations_operations_async.py +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/generated_tests/test_application_insights_managementweb_test_locations_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.applicationinsights.v2015_05_01.aio import ApplicationInsightsManagementClient +from azure.mgmt.applicationinsights.aio import ApplicationInsightsManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,7 +15,7 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestApplicationInsightsManagementWebTestLocationsOperationsAsync(AzureMgmtRecordedTestCase): +class TestApplicationInsightsManagementwebTestLocationsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(ApplicationInsightsManagementClient, is_async=True) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/tsp-location.yaml b/sdk/applicationinsights/azure-mgmt-applicationinsights/tsp-location.yaml new file mode 100644 index 000000000000..17a7cf87f33a --- /dev/null +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/applicationinsights/resource-manager/Microsoft.Insights/ApplicationInsights +commit: 99c35678fdca0ced74272dbf4513f6220db26593 +repo: Azure/azure-rest-api-specs +additionalDirectories: From 02e1d7321a1b29a62e4e0597148445e5d07684e6 Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 Date: Thu, 26 Mar 2026 11:44:57 +0800 Subject: [PATCH 3/3] changelog from report comparison --- .../CHANGELOG.md | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/sdk/applicationinsights/azure-mgmt-applicationinsights/CHANGELOG.md b/sdk/applicationinsights/azure-mgmt-applicationinsights/CHANGELOG.md index 613dedac4ae3..cf10245f7fea 100644 --- a/sdk/applicationinsights/azure-mgmt-applicationinsights/CHANGELOG.md +++ b/sdk/applicationinsights/azure-mgmt-applicationinsights/CHANGELOG.md @@ -2,7 +2,32 @@ ## 5.0.0b2 (2026-03-26) -skip changelog generation +### Breaking Changes + + - Package structure changed from multi-api versioned modules to a flat single-client module. Versioned import paths like `from azure.mgmt.applicationinsights.v2020_02_02.models import ...` are no longer available. + - Removed operation group `MyWorkbooksOperations` + - Removed operation group `ComponentCurrentPricingPlanOperations` + - Removed operation group `EASubscriptionListMigrationDateOperations` + - Removed operation group `EASubscriptionMigrateToNewPricingModelOperations` + - Removed operation group `EASubscriptionRollbackToLegacyPricingModelOperations` + - Renamed operation group `WebTestLocationsOperations` to `webTestLocationsOperations` + - Removed model `MyWorkbook` + - Removed model `MyWorkbookError` + - Removed model `MyWorkbookManagedIdentity` + - Removed model `MyWorkbookManagedIdentityType` + - Removed model `MyWorkbookResource` + - Removed model `MyWorkbookUserAssignedIdentities` + - Removed model `MyWorkbooksListResult` + - Removed model `ApplicationInsightsComponentPricingPlan` + - Removed model `EASubscriptionMigrationDate` + - Removed model `SharedTypeKind` + - Removed model `WebTestKindEnum` + - Removed model `Kind` + - Removed model `WorkbookResource` + +### Other Changes + + - Migrated from Swagger to TypeSpec ## 5.0.0b1 (2025-07-24)